
Le 22/08/11 19:46, Nevin Liber a écrit :
On 22 August 2011 10:30, Eric Niebler<eric@boostpro.com> wrote:
Do you still think that is easier than writing the move constructor and assignment operator for classes where the compiler generated one is wrong or deleted? I think it fills a different need.
Maybe at this point it would be nice if its proponents came up with a modern (i.e., why this would still be needed in a world with either C++11 or Boost.Move) motivating example or two. The Stepanov paper is a product of its time and no longer as useful for showing why we still need something like this. move-raw as std::move are optimizations. In addition to the optimizations introduced by std::move, move_raw don't need to left the moved object in a stable state, so it could be in some cases, as Eric told in another post, twice faster. This is the single reason to be for move_raw: optimization.
We can define a RawMovable concept and traits that states if a type is raw movable from another type (is_raw_movable). For these types we can specialize some algorithms that benefit from this optimization. Note that Movable will imply RawMovable if the default implementation uses std::move. Maybe this is not enough motivating for you, but it seem it is for others. Best, Vicente