Move vs. Copy
In this lesson we'll see how the std::move utility proves more efficient than copying.
The function std::move
, defined in the header <utility>
, empowers the compiler to move its resource. In the so-called move semantic, the values from the source object are moved to the new object. Afterward, the source is in a well-defined but not specified state. Most of the times that is the default state of the source. By using std::move
, the compiler converts the source arg
to a rvalue reference: static_cast<std::remove_reference<
...