// DiagInfoTest.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include class MyException : public virtual std::exception, public virtual boost::exception { }; void PrintExInfo() { std::stringstream s; std::string shortInfo = boost::current_exception_diagnostic_information(false); s << "Short info(" << shortInfo.size() << "): " << shortInfo << "\n"; std::string longInfo = boost::current_exception_diagnostic_information(); s << "Long info(" << longInfo.size() << "): " << longInfo << "\n"; std::cout << s.rdbuf(); } int main(int argc, char* argv[]) { try { throw std::exception(); } catch (...) { PrintExInfo(); } try { BOOST_THROW_EXCEPTION(std::exception()); } catch (...) { PrintExInfo(); } try { BOOST_THROW_EXCEPTION(MyException()); } catch (...) { PrintExInfo(); } return 0; }