// This file, part of a series, show why functors are so cool, // because they can maintain state information: // - from the constructor // - from call-to-call // // This code uses the remove_copy algorithm to remove the letter 'i' // from the name of the GREATEST STARSHIP CAPTAIN EVER! #include #include #include #include #include using namespace std; int main() { char name[] = "James Tiberius Kirk"; remove_copy(name, name+strlen(name), ostream_iterator(cout), 'i'); cout << '\n'; }