
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