
14 Dec
2009
14 Dec
'09
9:28 a.m.
2009/12/13 The Dude
It's true that none of these points is really a proof. Still, I'd be really happy to hack my own INDEX_FOREACH, but the 500+ LOCs of BOOST_FOREACH left me daunted.
It's not that hard: #define INDEX_FOREACH(index,a,b) \ for(unsigned int index = static_cast<unsigned int>(-1); \ index == static_cast<unsigned int>(-1);) \ BOOST_FOREACH(a,b) if(++index,true) INDEX_FOREACH(i, const Foo &f, foos) cout << "The bar of element " << i << " is " << f.bar() << endl;