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_guard<std::mutex>(m)), v) {
std::lock_guard<std::mutex> guard(m);
}
}
—
end example]