Boost logo

Boost :

Subject: Re: [boost] Boost and exceptions
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2012-06-24 01:47:56

On Sat, Jun 23, 2012 at 3:24 PM, Robert Ramey <ramey_at_[hidden]> wrote:

> Kim Barrett wrote:
> >
> > boost::throw_exception (in the interesting case, where
> > ensures that the thrown object is derived from boost::exception even
> > if the argument is not. It does this (via enable_error_info(), which
> > does the heavy lifting) by examining the type E of the argument. If E
> > is derived from boost::exception, then just use the argument as is.
> > Otherwise, construct a new object. The class of the new object
> > derives from both E and boost::exception (multiple inheritance), and
> > has a conversion constructor for arguments of type E which passes the
> > argument to the new class's base E object's copy constructor. Apply
> > that constructor to the original argument, and use the resulting
> > object. (Note that throw requires the argument to be copy
> > constructible, so the described mechanism imposes no new constraint on
> > E by requiring copy construction.)
> So any boost library which previously
> used boost::throw exception with an exception which was non-copyable
> would break? I guess we're lucky no one did that.

FYI the C++ standard requires that exception types must have accessible,
no-throw copy constructor.

Emil Dotchevski
Reverge Studios, Inc.

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