Hacker News new | past | comments | ask | show | jobs | submit login

In C++ you can force the move of the parameter by wrapping it with std::move() this should take care of unnecessarily cloning the argument in the example.





std::move does not force anything , it is a cast to an rvalue reference (a movable-from).

Whether the object is moved depends on whether the target / destination / sink cares.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: