• Create Account

### #ActualBitMaster

Posted 03 February 2014 - 08:54 AM

Correct me if I'm wrong, but there's little point in calling std::move on an lvalue (as is the case in your code).

It'd make more sense like this:



vector<Test> v;
v.push_back(std::move(Test()));

You are wrong. In your example you don't even need the std::move because 'Test()' is an xvalue as an expiring temporary. The whole point of std::move is to allow moving of what would usually be lvalues.

### #1BitMaster

Posted 03 February 2014 - 08:26 AM

Correct me if I'm wrong, but there's little point in calling std::move on an lvalue (as is the case in your code).

It'd make more sense like this:


vector<Test> v;
v.push_back(std::move(Test()));

You are wrong. In your example you don't even need the std::move because 'Test()' is an xvalue as an expiring temporary. The whole point of std::move it to allow it on what would usually be lvalues.

PARTNERS