[diff.cpp20.stmt] (original) (raw)
Annex C (informative) Compatibility [diff]
C.2 C++ and ISO C++ 2020 [diff.cpp20]
C.2.4 [stmt]: statements [diff.cpp20.stmt]
Affected subclause: [stmt.ranged]
Rationale: Improve usability of the range-based for statement.
Effect on original feature: Destructors of some temporary objects are invoked later.
[Example 1: void f() { std::vector<int> v = { 42, 17, 13 }; std::mutex m;for (int x : static_cast<void>(std::lock_guardstd::mutex\(m)), v) { std::lock_guardstd::mutex\ guard(m); } } — _end example_]