David Abrahams wrote:
[snip]
> 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
regard.

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:

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

Swap:
  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.

Eric



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to