'Range-based for' support for gcc
Flex Ferrum
flex_ferrum@artberg.ru
Sat Sep 11 21:14:00 GMT 2010
Hello.
It is a great effort to implement 'range-based for' in gcc 4.6. But it
could be interesting for you what recent C++0x standard draft (N3126)
contains some significant change for this feature:
------- begin quote ----------
6.5.4 The range-based for statement [stmt.ranged]
1 The For a range-based for statement of the form
for ( for-range-declaration : expression ) statement
let range-init be equivalent to the expression surrounded by parentheses:
( expression )
and for a range-based for statement of the form
for ( for-range-declaration : braced-init-list ) statement
let range-init be equivalent to the braced-init-list.
------- end quote ----------
which allows to use following construction:
for (auto i: {1, 2, 3, 4, 5})
{
std::cout << i << " ";
}
--
Best Regards,
Flex mailto:flex_ferrum@artberg.ru
More information about the Gcc
mailing list