greetings kind regards
may i please inquire how not to obtain "std::exception::what: Unknown exception" from diagnosic_inforumation() . my meaning is to inquire how to obtain as per example on boost web page
https://www.boost.org/doc/libs/1_83_0/libs/exception/doc/tutorial_diagnostic_information.htmloutput : "std::exception::what: example_io error"
id est where did "example_io error" come from as neither boost::exception nor std:::exception accept constructor string arguments .
please my code below .
thank you kindly
#include "stl" // #includes all stl #include files
#include "boost\exception\all.hpp"
using namespace std;
struct ceXception : virtual boost::exception, virtual std::exception
{
using this_type = ceXception;
ceXception() {}
auto what() { cerr << __FUNCSIG__ << endl; return string("return from " + string(__FUNCSIG__)); }
template<typename charType>
friend
std::basic_ostream<charType>& operator<<(std::basic_ostream<charType>& _ostream, const this_type&) { cerr << "to cerr from " << __FUNCSIG__ << endl; _ostream << "to ostream from " << __FUNCSIG__ << endl; return _ostream; }
};
void foo()
{
try { BOOST_THROW_EXCEPTION(ceXception()); }
catch (ceXception& e)
{
cerr << boost::diagnostic_information(e);
}
}
int main()
{
foo();
return 0;
}
_______________________________________________