Replace BOOST_FOREACH with range-based for.