Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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 commented Nov 10, 2011

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