Replaced the enchanced for loop with BOOST_FOREACH

Older compilers lack support for the range based for loop, so I replaced
it with BOOST_FOREACH
Fixed an error with the boost/foreach.hpp include