Y
Hacker News
new
|
ask
|
show
|
jobs
by
eterevsky
561 days ago
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.
1 comments
masklinn
561 days ago
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.
link
Whether the object is moved depends on whether the target / destination / sink cares.