// MT4Q2 - for_each #include #include #include #include #include "../Utilities/Utilities.h" int main() { title("MT4Q2 - for_each"); std::list theList{ "one ", "two ", "three", "four " }; std::string appendString = " - element"; std::for_each( begin(theList), end(theList), [&appendString](std::string& elem) { elem += appendString; } ); for (auto& elem : theList) { std::cout << "\n " << elem; } std::cout << "\n\n"; }