Subject: Re: [boost] Movable but not copyable bug?
From: Ion GaztaÃ±aga (igaztanaga_at_[hidden])
Date: 2014-08-25 18:23:23
El 25/08/2014 23:23, Peter Dimov escribiÃ³:
> 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.
Yes, but he is compiling in C++03, that's why he's getting:
error: passing âconst Fooâ as âthisâ argument of âFoo::operator
boost::rv<Foo>&()â discards qualifiers [-fpermissive]
In C++03 both will require the copy constructor (I think).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk