From: Emil Dotchevski (emil_at_[hidden])
Date: 2007-10-22 20:42:33
In the Boost Exception review process, several people have expressed
the opinion that since boost::exception (part of the proposed library)
is designed to act as a base class for all Boost exceptions, it should
also support cloning. This can be done by adding a clone() virtual
function to boost::exception.
There are several issues we have to consider.
First, should clone() be pure virtual, which would require all
deriving exceptions to implement it?
This can be achieved by modifying boost::throw_exception to throw a
type that derives from the passed exception type and implements
If we go that route, we must make sure that Boost does not contain a
"naked" throw statement (that is, a throw that does not call
boost::throw_exception.) This should be fine, since Boost libraries
are required to call boost::throw_exception anyway.
However, the functionality provided by boost::exception would be
desirable for user code as well, and thus it would make sense for
user-defined exception types to derive it. Which raises my second
question: should then user code also be required to throw exceptions
by calling boost::throw_exception?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk