BOOST_FOREACH is a Boost macro to replace for-loops or to simplify their corresponding algorithm.
#include <boost/foreach.hpp> //From http://www.richelbilderbeek.nl/CppTriple.htm template <class Container> void Triple(Container& c) { BOOST_FOREACH(typename Container::value_type& i, c) { i*=3; } } #include <vector> #include <cassert> int main() { std::vector<int> v; v.push_back(1); Triple(v); assert(v[0]==3); }