On 5/16/18, Andrea Arteaga via cfe-users <cfe-users@lists.llvm.org> wrote:
> Thanks for your reply, John.
> I fully understand your points, I actually had the same concern that a
> reference-to-rvalue warning would be issued for perfectly reasonable and
> intended code.

For example,

vector<int> ints{1,2,3,4,5};
auto i = ints.front();

Also, one may want to take a copy, e.g. for modifying it:

vector<string> strings{"foo", "bar"};
auto foo = strings.front();

You can get very substantial performance improvements by not doing the
right thing.
   - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformat way
to get the wrong information: this is what you want. - Scott Meyers
cfe-users mailing list

Reply via email to