1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#define BOOST_ENABLE_ASSERT_HANDLER
#include <boost/assert.hpp>
#include "../myexception.H"
#ifdef assert
#undef assert
#endif
#ifdef assert_msg
#undef assert_msg
#endif
#ifdef NDEBUG
#define assert(expr) (0?(void(expr)):(void(0)))
#define assert_msg(expr,message) (0?(void(expr)):(void(0)))
#else
#define assert(expr) BOOST_ASSERT(expr)
#define assert_msg(expr,message) BOOST_ASSERT_MSG(expr,message)
#endif
#ifndef UTIL_ASSERT_H
#define UTIL_ASSERT_H
namespace boost
{
inline void assertion_failed(char const * expr, char const * function, char const * file, long line)
{
throw myexception()<<"Assertion ("<<expr<<") failed in '"<<function<<"' at "<<file<<":"<<line;
}
inline void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line)
{
throw myexception()<<"Assertion ("<<expr<<") failed in '"<<function<<"' at "<<file<<":"<<line<<":\n "<<msg;
}
}
#endif
|