Boost C++ Libraries

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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Boost Exception

diagnostic_information

#include <boost/exception/diagnostic_information.hpp> 

namespace
boost
    {
    std::string diagnostic_information( boost::exception const & x );
    }

Returns:

This function iterates over all data objects stored in the boost::exception through operator<<. The returned string is constructed by converting each data object to string and then concatenating these strings together.

When the error_info<Tag,T> template is instantiated, the system attempts overload resolution for an unqualified call to to_string(x), where x is of type T. If this is successful, the to_string overload is expected to return std::string and is used to convert objects of type T to string.

Otherwise, the system attempts overload resolution for s << x, where s is a std::ostringstream and x is of type T. If this is successful, the operator<< overload is used to convert objects of type T to string.

Otherwise the system is unable to convert objects of type T to string, and an unspecified stub string value is used without issuing a compile error.

Notes:

  • The format of the returned string is unspecified.
  • The returned string is not user-friendly.
  • If dynamic_cast<std::exception const *>(&x) is not null, the returned string includes the output from std::exception::what.
  • The returned string may include additional platform-specific diagnostic information.