In this recipe, we will learn how to use perfect forwarding. This recipe is important because, often, when writing templates, we pass template parameters to other functions. If we do not use perfect forwarding, we can inadvertently convert r-value references into l-value references, resulting in a potential copy taking place instead of a move, which, in some cases, could be suboptimal. Perfect forwarding also provides the compiler with hints that could be leveraged to improve function inlining and unwrapping.
Learning perfect forwarding
Getting ready
Before beginning, please ensure that all of the technical requirements are met, including installing Ubuntu 18.04 or higher and running the following in a Terminal window:
>...