1 2 3 4 5 6 7 8 9 10
#include <iostream> #include <boost/foreach.hpp> int main() { int xs[3] = { }; BOOST_FOREACH(int x, xs) std::cout << x << std::endl; BOOST_FOREACH(int& x, xs) ++x; BOOST_FOREACH(int x, xs) std::cout << x << std::endl; }
1 2 3 4 5 6
0 0 0 1 1 1