&& and move function
I got this code:
1 2 3 4 5 6
|
class A;
A&& foo()
{
A a;
return std::move(a);
}
| |
My question is:
Should I get better performance if I use
A&& a = std::move(foo());
instead of
A&& a = foo();
Thank you.
Last edited on
std::move is needed to convert a l-value reference to an r-value reference. Since foo returns a r-val ref it won't have any effect
Topic archived. No new replies allowed.