
18 Sep
2006
18 Sep
'06
6:37 p.m.
Rob Caldecott wrote:
OK, I know BOOST_FOREACH isn't part of the official (1.33.1) build yet, but hopefully some people here are using this excellent algorithm and can help me out... (note that I am using MS Visual Studio 2005):
How can I use BOOST_FOREACH to iterate through a map? For example, the following won't build:
std::map
m; BOOST_FOREACH(std::pair p, m) { } I get the following error:
warning C4002: too many actual parameters for macro 'BOOST_FOREACH'
This is covered in the docs: http://tinyurl.com/l72gp Your solutions (pre-declare the loop variable or use a typedef) are the way to go. -- Eric Niebler Boost Consulting www.boost-consulting.com