std::for_each changed to boost_foreach