missing #include <algorithm>

this code uses std::for_each, but library "algorithm" is not included