c++ - New C++11 range-for (foreach) syntax: which compilers support it? -
i saw c++11 code fragment in this boostcon presentation jeremy siek:
deque<int> topo_order; topological_sort(g, front_inserter(topo_order)); (int v : topo_order){ //line 39 cout << tasks[v] << endl; }
upon trying compile in gcc there following error:
main.cpp:39: error: expected initializer before ‘:’ token
which got me wondering, compilers support syntax?
well, @ least gcc supports in 4.6 (feature called "range-based for"). if have latest version, don't forget add -std=c++0x
option.
Comments
Post a Comment