s3rvac's comments

s3rvac | 9 years ago | on: Auto Type Deduction in C++ Range-Based For Loops

Using const auto& over const auto makes your code more robust. For example, what if you later decide to change the type of items in the vector from ints to something that is more expensive to copy? You would need to track all uses of the vector and add an ampersand there. And as for the access speed, YMMV but compilers are generally good at optimizations and will drop the reference when it would be faster to just copy the items.
page 1