Created on 2013-05-13.00:00:00 last changed 148 months ago
Notes from the September, 2013 meeting:
CWG felt that this issue should be resolved by using the array variant of the range-based for implementation.
A simple example like
int main() {
int k = 0;
for (auto x : { 1, 2, 3 })
k += x;
return k;
}
requires that the <initializer_list> header be included, because the expansion of the range-based for involves a declaration of the form
auto &&__range = { 1, 2, 3 };
and a braced-init-list causes auto to be deduced as a specialization of std::initializer_list. This seems unnecessary and could be eliminated by specifying that __range has an array type for cases like this.
(It should be noted that EWG is considering a proposal to change auto deduction for cases involving braced-init-lists, so resolution of this issue should be coordinated with that effort.)
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2013-10-14 00:00:00 | admin | set | messages: + msg4625 |
| 2013-10-14 00:00:00 | admin | set | status: open -> drafting |
| 2013-05-13 00:00:00 | admin | create | |