Fixed issue where return has different meaning after switching from std::for_each to range for