Boost logo

Boost :

From: Emil Dotchevski (emil_at_[hidden])
Date: 2007-11-08 19:03:12


> > > I would hope to save exceptions thrown from 3rd party libraries. An
> > > intrusive approach wouldn't work.
> >
> > For boost::throw_exception to be able to register the exception type
> > from 3rd party libraries, they must call boost::throw_exception.
>
> No, they don't need to call throw_exception. Registration of an
> exception type can occur separately from the throw. For example, a user
> could register an exception thrown by a binary-only library.

Sure, but in this case registration wouldn't be automatic.

I think that implementing clone() automatically at the time of the
throw inside boost::throw_exception is the best approach, because the
throw statement is guaranteed to see the complete type, which is
required to define public no-throw copy constructor -- and this is
exactly what we need to implement clone().

In this case boost::throw_exception would become more generic, in that
it would not be just a mechanism for boost components to throw
exceptions, but would also become a way for 3rd party code to throw
exceptions such that they get automatic cloning, plus the data
transporting functionality from boost::exception.

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

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