repalce for() with std::for_each