This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
'Range-based for' support for gcc
- From: Flex Ferrum <flex_ferrum at artberg dot ru>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 11 Sep 2010 22:08:49 +0400
- Subject: 'Range-based for' support for gcc
- References: <1284144309.20525.ezmlm@gcc.gnu.org>
- Reply-to: Сергей Садовников <flex_ferrum at artberg dot ru>
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