Boost logo

Boost :

From: Eric Friedman (ebf_at_[hidden])
Date: 2003-08-29 15:51:28

David Abrahams wrote:
> 2.
> "All members of variant satisfy the strong guarantee of
> exception-safety."
> Seriously? What if an underlying type's assignment operator gives
> only the basic guarantee? Surely, if you in fact use the
> underlying type's assignment operator you can't give the strong
> guarantee?

I guess I should address this one a little more since I'm not exactly sure
if even the updated documentation describes variant correctly in this

Given a variant type with bounded types T1,...,Ti,...,Tj...,Tn and variant
objects vi (with content of type Ti) and vj (with content of type Tj), the
exception safety guarantee for variant is as follows:

  vi = Ti(...) // guarantee equal to Ti::operator=
  vi = vi // guarantee equal to Ti::operator=
  vi = vj // strong guarantee

  swap(vi, vi) // guarantee equal to swap( Ti, Ti )
  swap(vi, vj) // strong guarantee

Please let me know if the BoostBook documentation clearly describes what I
present here.


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