Boost logo

Boost Users :

Subject: Re: [Boost-users] [exception] Using Boost.Exception infrastructure without using boost::exception
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2011-05-29 00:01:56


On Sat, May 28, 2011 at 8:37 PM, Mostafa <mostafa_working_away_at_[hidden]> wrote:
>> All of the Boost Exception functionality works only if the exceptions
>> derive from boost::exception. Your only two choices are to do it
>> explicitly or to call boost::throw_exception which does it for you.
>
> It seems that some functionality doesn't, namely
> boost::enable_current_exception, and I was hoping to leverage such
> functionality to achieve my aforementioned goal.

boost::enable_current_exception enables the
boost::current_exception/boost::exception_ptr support by returning an
object that derives from boost::exception *and* the type of the passed
object.

Therefore:

throw boost::enable_current_exception(my_exception());

satisfies the requirement for deriving from boost::exception without
requiring my_exception to derive from boost::exception.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


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