#include #include #include using namespace std; template void print(vector v) { for(auto it = v.cbegin(); it!=v.cend(); it++) cout << *it << ", "; cout << endl; } void prefixMe(string& str) { str = "light " + str; } int main() { vector colors; colors.push_back("red"); colors.push_back("green"); colors.push_back("blue"); print(colors); for_each(colors.begin(), colors.end(), prefixMe); print(colors); }