https://github.com/apache/trafficserver/blob/master/proxy/logging/LogObject.cc#L1008
We also have cases of the opposite problem, using a reference for a container of pointers / iterators / string_views or other small objects. But this is less serious and probably just an aesthetic issue (gets optimized out). On Fri, Oct 26, 2018 at 5:32 PM Pushkar Pradhan <pprad...@oath.com> wrote: > > Good catch. In Modern Effective C++ Scott Myers talks about a few scenarios > when auto doesn't do what the programmer intended. > Earlier I was inclined to suggest that we should avoid auto in ATS but I > think it's better to make mistakes and learn. > > On Fri, Oct 26, 2018 at 3:21 PM Walt Karas <wka...@oath.com.invalid> wrote: >> >> This line of code: >> https://github.com/apache/trafficserver/blob/master/iocore/net/SSLSNIConfig.cc#L59 >> >> should be: >> for (const auto &item : Y_sni.items) { >> >> This causes item to be of type const Item & instead of Item. Thus >> avoiding making a copy of each element in the vector. Look at this >> example code: >> >> https://godbolt.org/z/7j0LFT >> >> Note in the assembler code how foo() calls the copy constructor for >> Item in the for loop, and foo2() does not. > > > > -- > pushkar