I'm reading Section 4.2.3 Initializing Containers, Tour of C++ Second Edition.
It says:
Vector read(istream& is) { Vector v; for (double d; is>>d;) v.push_back(d); return v; }... The way to provide
Vectorwith a move constructor, so that returning a potentially huge amount of data fromread()is cheap, is explained in §5.2.2:Vector v = read(cin); // no copy of Vector elements here
Is it guaranteed that the above expression will be copy-elided (in C++17)?
I think v in the return is an lvalue & a local variable, so it can be copy-elided but is not guaranteed to be elided.
Am I missing something here?