C++ Language/Indirection/RvalueReferences/PerfectForwarding

From Wikibooks, open books for an open world
Jump to navigation Jump to search

If both move-semantics and copy-semantics exist in both a base class and a derived class, then you might need to maintain the choice of move-or-copy when a derived class' function delegates up to the base class' function. To maintain that move-or-copy choice, std::forward<> is used.

Additional information about perfect forwarding (includes interactive examples)