This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

'Range-based for' support for gcc


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]