От: | flаt | ||
Дата: | 19.08.14 11:49 | ||
Оценка: |
the proposal for enhanced ranged-based for syntax to prevent accidental misuse (currently the recommended syntax is actuall for (auto && x : xs), but this will allow us to use for (x : xs))
for (auto i : range(10)) {
cout << i << '\n';
}
vector<int> vec{2, 4, 6, 8};
for (auto e : enumerate(vec)) {
cout << e.index
<< ": "
<< e.element
<< '\n';
}