От: | DiPaolo | ||
Дата: | 05.09.22 01:45 | ||
Оценка: |
If range-expression returns a temporary, its lifetime is extended until the end of the loop, as indicated by binding to the forwarding reference __range, but beware that the lifetime of any temporary within range-expression is not extended.
for (auto& x : foo().items()) { /* .. */ } // undefined behavior if foo() returns by value