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