Boost logo

Boost :

Subject: Re: [boost] [move] [range] move algorithm (was: interest: the pass-by-value...)
From: Eric Niebler (eniebler_at_[hidden])
Date: 2014-02-18 20:55:40


On 02/18/2014 03:47 PM, Neil Groves wrote:
> To me this indicates that I may have types where my "moved from" object is
> valid and in a specified state. I extrapolate from this that therefore it
> may be valid to move from the same object multiple times. I see no reason
> why I should not implement a pimpl idiom where the moved-from object has
> the pointer assigned to null and have valid multiple move operations from
> the same type.
>
> 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.

Eric


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk