Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards



Header <boost/core/verbose_terminate_handler.hpp>


  • Peter Dimov

The header <boost/core/verbose_terminate_handler.hpp> defines the function void boost::core::verbose_terminate_handler(). Its purpose is to be set as a terminate handler as in

std::set_terminate( boost::core::verbose_terminate_handler );

When invoked, the function prints information about the current uncaught exception to stderr and then calls std::abort.

namespace boost
namespace core

[[noreturn]] void verbose_terminate_handler();

} // namespace core
} // namespace boost
#include <boost/core/verbose_terminate_handler.hpp>
#include <boost/throw_exception.hpp>
#include <exception>

int main()
    std::set_terminate( boost::core::verbose_terminate_handler );
    boost::throw_with_location( std::exception() );

Sample output:

std::terminate called after throwing an exception:

      type: class boost::detail::with_throw_location<class std::exception>
    what(): Unknown exception
  location: example.cpp:8:12 in function 'main'