Forward

Now, we'll learn about the way std::forward helps us create generic function templates.

The function std::forward, defined in the header <utility>, empowers you to write function templates, which can identically forward their arguments. Typical use cases for std::forward are factory functions or constructors. Factory functions are functions which create an object and must therefore identically pass the arguments. Constructors often use their arguments to initialize their base class with identical arguments. So std::forward is the perfect tool for authors of generic libraries: