16.2.6. Understanding std::move
The library move
function (§ 13.6.1, p. 533) is a good illustration of a template that uses rvalue references. Fortunately, we can use move
without understanding the template mechanisms that it uses. However, looking at how move
works can help cement our general understanding, and use, of templates.
In § 13.6.2 (p. 534) we noted that although we cannot directly bind an rvalue reference to an lvalue, we can use move
to obtain an rvalue reference bound to an lvalue. Because move
can take arguments of essentially any type, it should not be surprising that move
is a function template.
How std::move
Is Defined
The standard ...
Get C++ Primer, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.