|
Boost Users : |
Subject: [Boost-users] [exception] Using Boost.Exception infrastructure without using boost::exception
From: Mostafa (mostafa_working_away_at_[hidden])
Date: 2011-05-28 21:27:26
I'm interested in using the infrastructure in Boost.Exception without
using using boost::exception or deriving from it. Is this possible, if
so, how? From the documentation, it seems so, but the documentation is
not totally clear on this.
From what I deduced, one should do:
class my_exception {};
//1
throw boost::enable_current_exception(my_exception());
//2
catch(my_exception & ex)
{
/do stuff ....
boost::rethrow_exception(boost::current_exception());
}
Though,
http://www.boost.org/doc/libs/1_46_1/libs/exception/doc/enable_current_exception.html
states:
Note: Instead of using the throw keyword directly, it is preferable to
call boost::throw_exception. This is guaranteed to throw an exception that
derives from boost::exception and supports the exception_ptr functionality.
And it's not very clear what exactly are the requirements for supporting
exception_ptr functionality if one doesn't derive from boost::exception.
Thanks,
Mostafa
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net