[RFC] C++11: beware unnecessary copies with auto

It’s easy to copy unintentionally when using ‘auto’, particularly inside
range-based for loops. My experience is that defaulting to const& makes
code easier to get right (and easier to read).

Anyone see an issue with the attached patch to the coding standards?

beware-copies-with-auto.patch (1.13 KB)

I am not a C++11 expert, but I must say I was very glad for the hint Duncan gave me. If there are no technical concerns, I am very much in favor of this addition.




+1, and I agree with Tobias -- it's a good reminder. :slight_smile:


Committed in r202729.