Boost logo

Boost :

Subject: Re: [boost] Movable but not copyable bug?
From: Peter Dimov (lists_at_[hidden])
Date: 2014-08-25 17:23:21


Ion Gaztañaga wrote:

> Maybe you should design your code in C++11 and port it to Boost.Move, you
> might get better compiler help.

His code compiles in C++11, as is.

> If this copy constructor is instantiated, and in many compilers
>
> Bar<Foo> b(( Bar<Foo>() ));
>
> requires the copy constructor, then you get a compilation error. Just try
> this equivalent (but more inefficient) code:
>
> Bar<Foo> a;
> Bar<Foo> b(a);

This is not equivalent. a is an lvalue here. In the above code, Bar<Foo>()
is an rvalue. It should use the move constructor, not the copy constructor.


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