Boost logo

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. ( 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.
> (
> 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.

Boost list run by bdawes at, gregod at, cpdaniel at, john at