// This example (part of a series) illustrates how to to use a functor. // // This file uses the same buffer for input & output of the transform // algorithm. #include #include #include using namespace std; char embiggen(char c) { if ('a' <= c && c <= 'z') return c - 'a' + 'A'; else return c; } int main() { string name = "Beverly Hills Chihuahua"; transform(name.begin(), name.end(), name.begin(), embiggen); cout << name << '\n'; }