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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -