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

Tobias Grosser tobias at grosser.es
Sun Mar 2 09:48:32 PST 2014


On 03/02/2014 06:03 PM, Duncan P. N. Exon Smith wrote:
> 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?

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.

Tobias



More information about the llvm-dev mailing list