mirror of
https://github.com/boostorg/exception.git
synced 2025-07-13 04:26:44 +02:00
Optimization for error_info<throw_function>, error_info<throw_file>, error_info<throw_line>. Refactored exception_ptr to use shared_ptr.
[SVN r48521]
This commit is contained in:
@ -11,7 +11,8 @@ typedef boost::error_info<struct test_tag,int> tag_int;
|
||||
|
||||
struct
|
||||
error1:
|
||||
public std::exception
|
||||
public std::exception,
|
||||
public boost::exception
|
||||
{
|
||||
char const *
|
||||
what() const throw()
|
||||
@ -22,18 +23,6 @@ error1:
|
||||
|
||||
struct
|
||||
error2:
|
||||
public std::exception,
|
||||
public boost::exception
|
||||
{
|
||||
char const *
|
||||
what() const throw()
|
||||
{
|
||||
return "error2";
|
||||
}
|
||||
};
|
||||
|
||||
struct
|
||||
error3:
|
||||
public boost::exception
|
||||
{
|
||||
};
|
||||
@ -44,56 +33,17 @@ main()
|
||||
using namespace boost;
|
||||
try
|
||||
{
|
||||
error1 x;
|
||||
error1 x; x << tag_int(42);
|
||||
BOOST_TEST(x.what()==std::string("error1"));
|
||||
throw x;
|
||||
}
|
||||
catch(
|
||||
std::exception & x )
|
||||
{
|
||||
std::string di=boost::diagnostic_information(x);
|
||||
BOOST_TEST(di.find("type:")!=std::string::npos);
|
||||
BOOST_TEST(di.find("error1")!=std::string::npos);
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
try
|
||||
{
|
||||
error2 x; x << tag_int(42);
|
||||
BOOST_TEST(x.what()==std::string("error2"));
|
||||
throw x;
|
||||
}
|
||||
catch(
|
||||
std::exception & x )
|
||||
{
|
||||
std::string di=boost::diagnostic_information(x);
|
||||
BOOST_TEST(di.find("type:")!=std::string::npos);
|
||||
BOOST_TEST(di.find("error2")!=std::string::npos);
|
||||
#ifndef BOOST_NO_RTTI
|
||||
BOOST_TEST(di.find("test_tag")!=std::string::npos);
|
||||
#endif
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
try
|
||||
{
|
||||
error2 x; x << tag_int(42);
|
||||
BOOST_TEST(x.what()==std::string("error2"));
|
||||
throw x;
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
std::string di=boost::diagnostic_information(x);
|
||||
BOOST_TEST(di.find("type:")!=std::string::npos);
|
||||
#ifndef BOOST_NO_RTTI
|
||||
BOOST_TEST(di.find("error2")!=std::string::npos);
|
||||
BOOST_TEST(di.find("type:")!=std::string::npos);
|
||||
BOOST_TEST(di.find("error1")!=std::string::npos);
|
||||
#endif
|
||||
BOOST_TEST(di.find("test_tag")!=std::string::npos);
|
||||
}
|
||||
@ -104,7 +54,7 @@ main()
|
||||
}
|
||||
try
|
||||
{
|
||||
error3 x;
|
||||
error2 x;
|
||||
x << tag_int(1);
|
||||
throw x;
|
||||
}
|
||||
|
Reference in New Issue
Block a user