Duncan P. N. Exon Smith
2014-Mar-02 17:03 UTC
[LLVMdev] [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? -------------- next part -------------- A non-text attachment was scrubbed... Name: beware-copies-with-auto.patch Type: application/octet-stream Size: 1160 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140302/e87d7f44/attachment.obj>
Tobias Grosser
2014-Mar-02 17:48 UTC
[LLVMdev] [RFC] C++11: beware unnecessary copies with auto
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
Renato Golin
2014-Mar-02 18:19 UTC
[LLVMdev] [RFC] C++11: beware unnecessary copies with auto
On 3 March 2014 01:48, Tobias Grosser <tobias at grosser.es> wrote:> 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 --renato
Reasonably Related Threads
- [LLVMdev] [RFC] Relax the rules on const auto&? (was Re: r203179 - [C++11] Replacing iterators redecls_begin() and redecls_end() ...)
- [LLVMdev] [RFC] C++11: beware unnecessary copies with auto
- [LLVMdev] compiler-rt with MSVC 2013
- [LLVMdev] compiler-rt with MSVC 2013
- [LLVMdev] compiler-rt with MSVC 2013