// Orz.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <vector> #include <algorithm> #include <cctype> #include <string> using namespace std; string& toLower(string& s) { // Modify each char element transform(s.begin(), s.end(), s.begin(), tolower); return s; } int _tmain(int argc, _TCHAR* argv[]) { vector<string> svec; svec.push_back("Stanley B. Lippman"); svec.push_back("Scott Meyers"); svec.push_back("Nicolai M. Josuttis"); // Modify each string element transform(svec.begin(), svec.end(), svec.begin(), toLower); copy(svec.begin(),svec.end(), ostream_iterator<string>(cout,"/n")); system("pause"); return 0; } 练习STL Transform