25 Aug
2014
25 Aug
'14
9:23 p.m.
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.