| 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 | // We deliberately use assert in here: |
| 7 | // |
| 8 | // boost-no-inspect |
| 9 | |
| 10 | #ifndef BOOST_MATH_TOOLS_ASSERT_HPP |
| 11 | #define BOOST_MATH_TOOLS_ASSERT_HPP |
| 12 | |
| 13 | #include <boost/math/tools/is_standalone.hpp> |
| 14 | |
| 15 | #ifndef BOOST_MATH_STANDALONE |
| 16 | |
| 17 | #include <boost/assert.hpp> |
| 18 | #include <boost/static_assert.hpp> |
| 19 | #define BOOST_MATH_ASSERT(expr) BOOST_ASSERT(expr) |
| 20 | #define BOOST_MATH_ASSERT_MSG(expr, msg) BOOST_ASSERT_MSG(expr, msg) |
| 21 | #define BOOST_MATH_STATIC_ASSERT(expr) BOOST_STATIC_ASSERT(expr) |
| 22 | #define BOOST_MATH_STATIC_ASSERT_MSG(expr, msg) BOOST_STATIC_ASSERT_MSG(expr, msg) |
| 23 | |
| 24 | #else // Standalone mode - use cassert |
| 25 | |
| 26 | #include <cassert> |
| 27 | #define BOOST_MATH_ASSERT(expr) assert(expr) |
| 28 | #define BOOST_MATH_ASSERT_MSG(expr, msg) assert((expr)&&(msg)) |
| 29 | #define BOOST_MATH_STATIC_ASSERT(expr) static_assert(expr, #expr " failed") |
| 30 | #define BOOST_MATH_STATIC_ASSERT_MSG(expr, msg) static_assert(expr, msg) |
| 31 | |
| 32 | #endif |
| 33 | |
| 34 | #endif // BOOST_MATH_TOOLS_ASSERT_HPP |
| 35 | |