Hello every one,
I would like to know how I can use BOOST_FOREACH for map container. if the map format is like : std::map< std::string, std::set<int> > how I can access each key with BOOST_FOREACH.
I will appreciate any help
regards
thanks for your help. however, may I know why I have received this error " test6.cpp:15:53: error: macro "BOOST_FOREACH" passed 3 arguments, but takes just
2
BOOST_FOREACH(const std::pair<int, int> & k, my_map)
^
test6.cpp: In function 'int main()':
test6.cpp:15:2: error: 'BOOST_FOREACH' was not declared in this scope
BOOST_FOREACH(const std::pair<int, int> & k, my_map)" for below code :
The key is const for a good reason. Any change of the value would need a reorganization of the map. In your case 1 becomes 2 -> What happens to the already existing 2?
[EDIT]
Oh, and you cannot use a comma for a macro parameter (like the comma in pair: std::pair<int, int>). So you need a typedef or what cire showed.