Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22029

Range-based for loop without specifying variable type

$
0
0

I just discovered that this compiles fine with no error (gcc 5.3):

std::vector<whatever> vec;

for( e: vec )
  // do something

All the compiler does is issue this warning:

warning: range-based for loop without a type-specifier only available with -std=c++1z or -std=gnu++1z

Could someone explain:

  • what that code does (is it only a way to assume auto without typing it, or is there more ?)
  • what c++1z is (I know c++11, c++14, never heard of c++1z...)

Viewing all articles
Browse latest Browse all 22029

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>