From: David Abrahams (dave_at_[hidden])
Date: 2003-10-27 12:18:29
Eric Friedman <ebf_at_[hidden]> writes:
>> is calling a nothrow constructor, then the "destroy, then create"
>> ordering can still preserve the strong guarantee, it seems.
> Variant provides the basic guarantee for assignment lhs = rhs by
> copying the content of lhs onto the heap before its destruction. Then
> the content of rhs is copied to the storage of lhs. In the event of
> success, the backup is destroyed; in the event of an exception, the
> lhs variant stores a pointer to the backup and "redirects" all
> visitation requests accordingly.
What a surprise. Why would you want to pay for the copy back to the
stack once you've paid for heap allocation? I guess if you're worried
about sucking up heap memory it might be important. If you're worried
about speed it could be bad. Hmm, sounds like a policy :(.
-- Dave Abrahams Boost Consulting 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