
2009/8/4 Oliver Kania <kania.oliver@googlemail.com>:
Hello , I have a problem getting boost foreach to work with a vector of tuples of type tuple<int,int>:
#define foreach BOOST_FOREACH .... vector<tuple<int,int> > l_listLeftLines; .... foreach (boost::tuple<int,int>& i_pair, l_listLeftLines) { ..... }
The visual studio compiler gives me the following :
1>d:\projects\software\lib_msvc\ptw2ddatalib20\source\ptwfieldcheckalgorithm.cpp(227) : warning C4002: too many actual parameters for macro 'BOOST_FOREACH' 1>d:\projects\software\lib_msvc\ptw2ddatalib20\source\ptwfieldcheckalgorithm.cpp(227) : error C2143: syntax error : missing ')' before '>'
..... and a long tail of more errors
best regards, Oliver
Hi, Try with: foreach ((boost::tuple<int,int>& i_pair), l_listLeftLines) The issue is that < and > are not delimiters for the macro, so you have actually 3 parameters if you don't add the parenthesis. Matthieu -- Information System Engineer, Ph.D. Website: http://matthieu-brucher.developpez.com/ Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn: http://www.linkedin.com/in/matthieubrucher