Boost logo

Boost :

Subject: Re: [boost] [function] function wrapping with no exceptionsafetyguarantee
From: Emil Dotchevski (emil_at_[hidden])
Date: 2010-10-22 15:39:24


On Fri, Oct 22, 2010 at 10:35 AM, Daniel Walker
<daniel.j.walker_at_[hidden]> wrote:
> Oops. Sorry, I spoke too soon. In fact, it IS currently possible for a
> boost::function object to become empty due to a failed assignment. It
> happens because the small object manager clones the target during a
> call to swap(). If there is an exception during the allocation,
> boost::function handles it, sets itself to empty and rethrows.

Unless you can find specific documentation for this behavior (I
couldn't), you can't assume that op= will leave the target empty upon
failure. AFAIK it provides only basic exception safety, meaning the
state of the target is unspecified upon failure except that no memory
will leak.

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