Learning perfect forwarding

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset