|
Boost : |
Subject: Re: [boost] [move] [range] move algorithm (was: interest: the pass-by-value...)
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2014-02-19 03:56:50
On 19-02-2014 02:55, Eric Niebler wrote:
>> I therefore think there are a number of reasons to strongly disagree with
>> the notion that a move iterator must be an Input Iterator.
>
> Yes, it's safe to assume that moved-from objects are in some valid
> state. That's not the issue. The moved-from state is almost guaranteed
> to be different from the state the object had before the move. The issue
> here is that the *algorithms* don't expect values in the sequence
> changing out from under them. This breaks assumptions all over the
> place. Algorithms *will* give nonsensical results when called with move
> iterators. It's practically guaranteed.
What would be the guarantees that an algorithm had to give for it to
work. Would the following be sufficient:
a. elements are only moved around by swap() (which moves)
b. no element is ever assigned to local variable (reference type or not)
?
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk