"Eric Friedman" <[EMAIL PROTECTED]> writes: > 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.
I will when I find out where it is. BTW, after looking at the implementation I was a bit disappointed to see two copies of the storage. It seems to nullify one important reason for using variants (space savings), and it generates more code than a single-storage version. I know you had some rationale for that but I don't remember what it is; I hope it's in the docs along with some explanation of the expected size of the resulting object. Regards, Dave -- Dave Abrahams Boost Consulting www.boost-consulting.com _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost