mirror of
https://github.com/boostorg/json.git
synced 2025-05-11 21:53:58 +00:00
throw_exception is user-provided in standalone
This commit is contained in:
parent
0c935f9cc9
commit
0acf98c1e6
@ -75,7 +75,7 @@ as part of Boost, or in the standalone flavor (without Boost):
|
||||
* Aliases for standard types use their `std` equivalents
|
||||
* Obtained when defining the macro `BOOST_JSON_STANDALONE`
|
||||
* Link to a built static or dynamic standalone library, or use header-only (below)
|
||||
* Supports -fno-exceptions, define `BOOST_NO_EXCEPTIONS` manually
|
||||
* Supports -fno-exceptions: define `BOOST_NO_EXCEPTIONS` and `boost::throw_exception` manually
|
||||
|
||||
### Header-Only
|
||||
|
||||
|
@ -83,7 +83,7 @@ as part of Boost, or in the standalone flavor (without Boost):
|
||||
* Aliases for standard types use their `std` equivalents
|
||||
* Obtained when defining the macro `BOOST_JSON_STANDALONE`
|
||||
* Link to a built static or dynamic standalone library, or use header-only (below)
|
||||
* Supports -fno-exceptions, define `BOOST_NO_EXCEPTIONS` manually
|
||||
* Supports -fno-exceptions: define `BOOST_NO_EXCEPTIONS` and `boost::throw_exception` manually
|
||||
|
||||
[heading Header-Only]
|
||||
|
||||
|
@ -22,18 +22,25 @@
|
||||
BOOST_JSON_NS_BEGIN
|
||||
|
||||
#ifdef BOOST_JSON_STANDALONE
|
||||
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
// When exceptions are disabled
|
||||
// in standalone, you must provide
|
||||
// this function.
|
||||
BOOST_NORETURN
|
||||
void
|
||||
throw_exception(std::exception const&);
|
||||
|
||||
#else
|
||||
template<class E>
|
||||
void
|
||||
BOOST_NORETURN
|
||||
throw_exception(E e)
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
throw e;
|
||||
#else
|
||||
(void)e;
|
||||
std::terminate();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace detail {
|
||||
|
Loading…
x
Reference in New Issue
Block a user