1// (C) Copyright Matt Borland 2021.
2// Use, modification and distribution are subject to the
3// Boost Software License, Version 1.0. (See accompanying file
4// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6#ifndef BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP
7#define BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP
8
9#include <boost/math/tools/is_standalone.hpp>
10
11#ifndef BOOST_MATH_STANDALONE
12
13#if defined(_MSC_VER) || defined(__GNUC__)
14# pragma push_macro( "I" )
15# undef I
16#endif
17
18#include <boost/throw_exception.hpp>
19#define BOOST_MATH_THROW_EXCEPTION(expr) boost::throw_exception(expr);
20
21#if defined(_MSC_VER) || defined(__GNUC__)
22# pragma pop_macro( "I" )
23#endif
24
25#else // Standalone mode - use standard library facilities
26
27#ifdef _MSC_VER
28# ifdef _CPPUNWIND
29# define BOOST_MATH_THROW_EXCEPTION(expr) throw expr;
30# else
31# define BOOST_MATH_THROW_EXCEPTION(expr)
32# endif
33#else
34# ifdef __EXCEPTIONS
35# define BOOST_MATH_THROW_EXCEPTION(expr) throw expr;
36# else
37# define BOOST_MATH_THROW_EXCEPTION(expr)
38# endif
39#endif
40
41#endif // BOOST_MATH_STANDALONE
42
43#endif // BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP
44

source code of boost/libs/math/include/boost/math/tools/throw_exception.hpp