3 ms·
references prolong the lifetime of temporaries. It wouldn't work in this case: vector<int> v =...; const auto& x = v[59]; v.clear(); // x is dangling
by gpderetta 10y ago
references prolong the lifetime of temporaries. It wouldn't work in this case:
vector<int> v =...;
const auto& x = v[59];
v.clear();
// x is dangling