Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-08-07 15:21:18


From: "Eric Friedman" <ebf_at_[hidden]>

> Three questions come to my mind:
>
> * Are there any implementations that do not behave as desired under
> this undefined
> behavior? (Or more fundamentally, what is the reason for the
> standard's behavior
> on this issue?)

I don't know about that.

> * Is it a major obstacle that Boost.Variant will not offer
> exception-safe assign
> or swap unless externally wrapped with the pimpl idiom? Should
> boost::fast_variant
> and boost::safe_variant be introduced to encapsulate yet allow choice
> in this issue?

Wait!

***** There's nothing unsafe about the basic guarantee. *****

The strong guarantee is not the holy grail of exception-safety, as many
people seem to think. It's just a useful behavior to distinguish. There's
no reason to resort to heroics just to achieve it.

> * Any ideas out there as to how to make variant::operator= and
> variant::swap "as safe
> as possible," yet still efficient, even if we can't guarantee strong
> exception-safety?

Sure, just do the straightforward assignment and swap provided by the
underlying type.

-----------------------------------------------------------
           David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com


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