Boost logo

Boost :

Subject: Re: [boost] Boost and exceptions
From: John Maddock (boost.regex_at_[hidden])
Date: 2012-06-23 10:22:32


>>> From what I can find in the list archives [1], Boost.FileSystem also had
>>> a
>> similar issue with the requirement that thrown exceptions inherit from
>> std::exception. However, I'm not sure if [1] prompted the
>> FileSystem-local
>> hook or if it was resolved in some other way.
>
> All exceptions should inherit from std::exception. There is no need to
> involve the boost::exception type in your code to use throw_exception.

This works both ways - you can and should inherit from std::exception
whether you use BOOST_THROW_EXCEPTION or not, it's just that in the latter
case, they will also inherit from boost::exception (via multiple inheritance
if I understand the machinery correctly).

John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk