Do you know it?
Your handy cut-out-and-keep guide to std::forward and std::move
by Glennan Carnie
From the article:
I love a good ‘quadrant’ diagram. It brings me immense joy if I can encapsulate some wisdom, guideline or rule-of-thumb in a simple four-quadrant picture.
This time it’s the when-and-where of std::move and std::forward. In my experience, when programmers are first introduced to move semantics, their biggest struggle is to know when (or when not) to apply std::move or std::forward. Usually, it’s a case of “keep apply std::move until it compiles”. I’ve been there myself.
To that end I’ve put together a couple of a simple overview quadrant graphics to help out the neophyte ‘mover-forwarder’. The aim is to capture some simple rules-of-thumb in an easy-to-digest format...
Add a Comment
Comments are closed.