Y
Hacker News
new
|
ask
|
show
|
jobs
by
gpderetta
3573 days 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