Skip to content

Instantly share code, notes, and snippets.

@clarkli86
Created August 18, 2015 06:23
Show Gist options
  • Select an option

  • Save clarkli86/b61a7bbe6e26761d5446 to your computer and use it in GitHub Desktop.

Select an option

Save clarkli86/b61a7bbe6e26761d5446 to your computer and use it in GitHub Desktop.
range-based-for and initializer_list in C++
for (int x : {-1, -2, -3}) // the rule for auto makes this ranged-for work
std::cout << x << ' ';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment