Re:C++: Return value optimization vs. std::move
by tomjakubowski on Monday July 20, 2015 @11:50AM
(#9916827)
It'd be a problem if the function returned BigObject&&, but since it returns BigObject the move happens inside the function body which should be fine (modulo the issues raised in the article).
[ Parent
| on HN ]
Re:C++: Return value optimization vs. std::move
by seabee on Monday July 20, 2015 @12:04PM
(#9916951)
In the last snippet the function returns BigObject&&.
Re:C++: Return value optimization vs. std::move
by jayrhynas on Monday July 20, 2015 @12:59PM
(#9917325)
I'm not sure if he updated the article since you read it, but he does have a note about that:
> Note: We should not use this way in the real development, because it is a reference to a local object. Here just show how to make RVO happened.
Re:C++: Return value optimization vs. std::move
by tomjakubowski on Monday July 20, 2015 @02:27PM
(#9917997)
Oh my goodness. I'll blame that one on recovering from a bad cold.