|
Boost : |
From: Emil Dotchevski (emil_at_[hidden])
Date: 2007-11-06 17:44:31
> Here is a generic exception_ptr implementation based on a registry of
> exception types. (http://joshuanapoli.com/exception/) The registry is
> built at runtime. boost::throw_exception can register the thrown type.
> current_exception() searches for the most derived type in the registry
> that matches the current exception.
> (http://joshuanapoli.com/exception/jn/boost/exception/detail/emulate_exc
> eption_ptr.hpp)
If boost::throw_exception is modified such that its postcondition is
that the exception object it throws derives from boost::exception (I
can't think of a reason not to), cloning can be implemented
intrusively without a need for registration.
A run-time registry maintained by boost::throw_exception could cause
problems in multi-threaded environments, as well as in the presence of
DLLs (consider that if a DLL is unloaded, any std::type_info object
obtained from it becomes invalid, so it can not be used safely as a
key in the registry.)
-- 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