assert.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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. #ifndef BOOST_MATH_TOOLS_ASSERT_HPP
  10. #define BOOST_MATH_TOOLS_ASSERT_HPP
  11. #include <boost/math/tools/is_standalone.hpp>
  12. #ifndef BOOST_MATH_STANDALONE
  13. #include <boost/assert.hpp>
  14. #include <boost/static_assert.hpp>
  15. #define BOOST_MATH_ASSERT(expr) BOOST_ASSERT(expr)
  16. #define BOOST_MATH_ASSERT_MSG(expr, msg) BOOST_ASSERT_MSG(expr, msg)
  17. #define BOOST_MATH_STATIC_ASSERT(expr) BOOST_STATIC_ASSERT(expr)
  18. #define BOOST_MATH_STATIC_ASSERT_MSG(expr, msg) BOOST_STATIC_ASSERT_MSG(expr, msg)
  19. #else // Standalone mode - use cassert
  20. #include <cassert>
  21. #define BOOST_MATH_ASSERT(expr) assert(expr)
  22. #define BOOST_MATH_ASSERT_MSG(expr, msg) assert((expr)&&(msg))
  23. #define BOOST_MATH_STATIC_ASSERT(expr) static_assert(expr, #expr " failed")
  24. #define BOOST_MATH_STATIC_ASSERT_MSG(expr, msg) static_assert(expr, msg)
  25. #endif
  26. #endif // BOOST_MATH_TOOLS_ASSERT_HPP