Skip to content

Instantly share code, notes, and snippets.

@dazfuller
Created November 10, 2011 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dazfuller/1353921 to your computer and use it in GitHub Desktop.
Save dazfuller/1353921 to your computer and use it in GitHub Desktop.
Ignoring the Voices: C++11 Example - Range-For Statement
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
vector<string> a = { "Ignoring", "The", "Voices" };
for (const auto s : a)
{
cout << s << endl;
}
}
@dazfuller
Copy link
Author

Compiled as follows with GCC 4.6.1 on Ubuntu 11.10

g++ -std=c++0x -Wall -Werror -o range_for_loop range_for_loop.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment