// This example (part of a series) illustrates how to to use a functor. // // This code uses an actual functor, as opposed to a function. #include #include #include using namespace std; class embiggen { public: char operator()(char c) const { if ('a' <= c && c <= 'z') return c - 'a' + 'A'; else return c; } }; int main() { string name = "Beverly Hills Chihuahua"; embiggen biggifier; transform(name.begin(), name.end(), name.begin(), biggifier); cout << name << '\n'; }