Move Semantics
Learn about move semantics, its purpose, and how it is used.
We'll cover the following
Silent copy for a move request
As we saw previously, const
variables lose their ability to use move semantics. This means that instead, they use copy semantics (=
) for all move requests.
Because the variable cannot change, C++ cannot generate any of the special functions that involve affecting the variable, such as move.
Let’s look at an example to make it clearer.
A silent copy for a move request without move semantics is demonstrated below:
Get hands-on with 1400+ tech skills courses.