This is the test program I would like to be explained to me:
#include <iostream>
#include <string>
#include <boost/exception.hpp>
struct MyException: virtual boost::exception{ };
class MyClass
{
char* s;
public:
MyClass(const char* msg) : s(strdup(msg)){ }
MyClass(const MyClass& c){ s = strdup(c.s); }
~MyClass(){ free(s); }
};
void main()
{
MyException ex;
ex << boost::error_info<struct my_tag1, MyClass>("qweqwe");
ex << boost::error_info<struct my_tag2, std::string>("asdasd");
std::cout << boost::diagnostic_information(ex);
}
This is the program output:
> Throw in function (unknown)
> Dynamic exception type: struct MyException
> [PAUmy_tag1@?1?main@] = [ type: ?AV?$error_info@Umy_tag1@?1?main@VMyClass
@@@boo
> t@@, size: 8, dump: 50 69 10 01 b8 18 7f 00 ]
> [PAUmy_tag2@?1?main@] = asdasd
So, my question: what should I do with 'MyClass' to see the output like
this:
> Throw in function (unknown)
> Dynamic exception type: struct MyException
> [PAUmy_tag2@?1?main@] = qweqwe (Wow !!! Terrible dump is replaced with
readable string here !!!???)
> [PAUmy_tag2@?1?main@] = asdasd
Thanks, Andrew.