Pete Bartlett
See this thread http://thread.gmane.org/gmane.comp.lib.boost.user/54162 And the resulting Trac ticket: https://svn.boost.org/trac/boost/ticket/3469
for a essentially negative answer.
Personally, I like the answer in that thread that said: #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) The for loop just does a variable declaration in a way that means you won't get bit by using it somewhere that doesn't allow variable declarations. Convoluted but important. Of course, it isn't that generic - it always assumes you want an int index. But then that is what the question said... Jerry