I tried to write a simple loop through map<int, int>
element and I'm wondering why the 1st syntax I used doesn't work/compile ?
The 1st version I wrote was the following and it doesn't compile with VS'2008 / boost version 1.44:
std::map<int, int> myMap;
...
BOOST_FOREACH(map<int, int>::value_type &p, myMap)
{
}
Now if I rewrite the code like below the compilation is ok, but why ?
typedef std::map<int, int> myMap_t;
myMap_t myMap;
...
BOOST_FOREACH(myMap_t::value_type &p, myMap)
{
}
It is a preprocessor macro, and it doesn't like the ,
in map<int, int>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With