Boost logo

Boost :

From: Steven Watanabe (steven_at_[hidden])
Date: 2007-10-21 21:22:04


AMDG

Mathias Gaunard <mathias.gaunard <at> etu.u-bordeaux1.fr> writes:

> The problem with small object optimization is that you get the same
> issue that boost.variant has: it's hard to maintain the never-empty
> guarantee in operator=, because the copy constructor of a new value can
> throw and thus you lose the old value.

When I was trying to do this I only used the small
object optimization for types that I knew to have a no-throw
copy constructor (i.e. builtin types at the moment). In C++Ox
this can be loosened to having a no-throw move constructor.

> I wonder, by the way, how boost.function solves that issue.

It doesn't. Boost.Function can be empty and assignment for
Boost.Function does not provide the strong guarantee of
exception safety.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk