13.6.3. Rvalue References and Member Functions
Member functions other than constructors and assignment can benefit from providing both copy and move versions. Such move-enabled members typically use the same parameter pattern as the copy/move constructor and the assignment operators—one version takes an lvalue reference to
const, and the second takes an rvalue reference to non
For example, the library containers that define
push_back provide two versions: one that has an rvalue reference parameter and the other a
const lvalue reference. Assuming
X is the element type, these containers define:
void push_back(const X&); // copy: binds to ...