Subject: Re: [boost] [variant] Please vote for behavior
From: Dave Abrahams (dave_at_[hidden])
Date: 2013-02-01 12:15:07
on Fri Feb 01 2013, Paul Smith <pl.smith.mail-AT-gmail.com> wrote:
> On Fri, Feb 1, 2013 at 4:57 PM, Dave Abrahams <dave_at_[hidden]> wrote:
>> on Thu Jan 31 2013, Paul Smith <pl.smith.mail-AT-gmail.com> wrote:
>>> Actually, that's not really what I asked. Joel asked you if
>>> destructibility and assignability is all the standard library needs
>>> from moved-from objects. You responded: "That's all the standard
>>> library will use."
>>> Now you seem to say the opposite.
>>> I think this was a source of confusion :-)
>> I can imagine it would be.
> Okay, I'm truely confused about what you're saying then.
> Either the standard library requires moved-from user-types to keep
> meeting all their requirements, or it only requires them to remain
> destructible and assignable.
Not knowing if there's specific text about this, I can't say for sure.
If, as I think is likely, what it requires of them is not explicitly
called out, then it is implied by other requirements. In other words,
the library has the freedom to perform any operations on such objects as
it may perform on any other object in the same context. For example, in
a call to sort(first, last), it is free to compare two objects in the
range [first,last) even if one or both of them has been moved-from, so
the objects passed to such a call must, technically, preserve
less-than-comparability of moved-from objects.
In practice, though, IIUC implementations will only actually use
assignment and destruction on moved-from objects.
> The standard says the former.
If you say so.
> The wording that appears in the standard is the same (or almost the
> same) wording as the resolution of N3264, which is what you say you
> fought for.
> The only other way I can interpret "That's (destructibility and
> assignability) all that srandard library will use" is "that's all it
> will use in practice", but you say you disavow that.
No, I only disavow these parts of what you attributed to me:
"it's not something the standard actually guarantees in general, though,
and the requirements are still much stricter, perhaps superfluously
so. ... it's a good selling point for having destructive move semantics."
> So, please, could you rephrase this sentence in a more elaborate way?
-- Dave Abrahams BoostPro Computing Software Development Training http://www.boostpro.com Clang/LLVM/EDG Compilers C++ Boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk