#define BOOST_ENABLE_ASSERT_HANDLER
#include "boost/assert.hpp"
#include <iostream>
namespace boost
{
void assertion_failed(char const * expr, char const * function, char const * file, long line)
{
std::cout<<"lalala"<<std::endl;
}
}
int main()
{
BOOST_ASSERT(false);
return 0;
}
输出:lalala
#include "boost/assert.hpp"
#include <iostream>
namespace boost
{
void assertion_failed(char const * expr, char const * function, char const * file, long line)
{
std::cout<<"lalala"<<std::endl;
}
}
int main()
{
BOOST_ASSERT(false);
std::cout<<"haha"<<std::endl;
return 0;
}
报错
#define BOOST_DISABLE_ASSERTS
//#define BOOST_ENABLE_ASSERT_HANDLER
#include "boost/assert.hpp"
#include <iostream>
namespace boost
{
void assertion_failed(char const * expr, char const * function, char const * file, long line)
{
std::cout<<"lalala"<<std::endl;
}
}
int main()
{
BOOST_ASSERT(false);
std::cout<<"haha"<<std::endl;
return 0;
}