boost_no_range_based_for.ipp 618 B

1234567891011121314151617181920212223
  1. // Copyright Beman Dawes 2012
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // See http://www.boost.org/LICENSE_1_0.txt
  4. // See http://www.boost.org/libs/config for more information.
  5. // MACRO: BOOST_NO_CXX11_RANGE_BASED_FOR
  6. // TITLE: C++11 ranged-based for statement unavailable
  7. // DESCRIPTION: The compiler does not support the C++11 range-based for statement
  8. namespace boost_no_cxx11_range_based_for {
  9. int test()
  10. {
  11. // example from 6.5.4 The range-based for statement [stmt.ranged]
  12. int array[5] = { 1, 2, 3, 4, 5 };
  13. for (int& x : array)
  14. x *= 2;
  15. return 0;
  16. }
  17. }