// Illustrating the generic adjacent_find algorithm #include #include #include #include #include #include using namespace std; int main() { cout << "Illustrating the generic adjacent_find algorithm." << endl; deque player(5); deque::iterator i; // Initialize the deque: player[0] = "Pele"; player[1] = "Platini"; player[2] = "Maradona"; player[3] = "Maradona"; player[4] = "Rossi"; // Find the first pair of equal consecutive names: i = adjacent_find(player.begin(), player.end()); assert (*i == "Maradona" && *(i+1) == "Maradona"); // Find the first name that is lexicographically // greater than the following name: i = adjacent_find(player.begin(), player.end(), greater()); assert (*i == "Platini" && *(i+1) == "Maradona"); cout << " --- Ok." << endl; return 0; }