/* ----------------------------------------------------------------------- *//** * * @file Assertions_impl.cpp * * @brief Boost assertion handler * * See the comments in BoostIntegration.hpp. * *//* ----------------------------------------------------------------------- */ #include #include #include namespace boost { /** * @brief Boost failed assertion handler, with message * * @internal * If the macro \c BOOST_ENABLE_ASSERT_HANDLER is defined when * is included, instead of sending a error * message to an output stream, the expression * ::boost::assertion_failed_msg(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__) * is evaluated. */ inline void assertion_failed_msg(char const *inExpr, char const *inMsg, char const *inFunction, char const *inFile, long inLine) { std::stringstream tmp; tmp << inMsg << "\nDetails (for developers): \n" "Failed BOOST_ASSERT: " << inExpr << "\nFunction: " << inFunction << "\nFile: " << inFile << ":" << inLine; throw std::runtime_error( tmp.str() ); } /** * @brief Boost failed assertion handler, without message * * @internal * If the macro \c BOOST_ENABLE_ASSERT_HANDLER is defined when * is included, BOOST_ASSERT(expr) * evaluates \c expr and, if the result is false, evaluates the expression * ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__) */ inline void assertion_failed(char const *inExpr, char const *inFunction, char const *inFile, long inLine) { assertion_failed_msg("A run-time error occurred.", inExpr, inFunction, inFile, inLine); } } // namespace boost