...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
#include <boost/exception/exception.hpp> #include <boost/current_function.hpp> #include <boost/shared_ptr.hpp> namespace boost { template <class Tag,class T> class error_info { public: typedef T value_type; error_info( value_type const & ); }; template <class ErrorInfo,class E> shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & x ); typedef error_info<struct tag_throw_function,char const *> throw_function; typedef error_info<struct tag_throw_file,char const *> throw_file; typedef error_info<struct tag_throw_line,int> throw_line; #define BOOST_ERROR_INFO\ ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\ ::boost::throw_file(__FILE__) <<\ ::boost::throw_line((int)__LINE__) template <class E, class Tag, class T> E const & operator<<( E const & x, error_info<Tag,T> const & v ); }