February 25, 2020
How I use references
Following a blog post by Herb Sutter, let me tell you how and when I use references.
If I do not need to mutate an input parameter, I will use a const reference, unless I know that copying is cheaper (When in doubt use a reference). If I do need a copy of the parameter, I accept it by value and move it If I do need to mutate an input parameter, I will accept an input reference.
Read more