00 /* 01 * adjacent_find.cpp 02 * 03 * Author: Simonas Saltenis / Kurt Nørmark 04 */ 05 06 #include <iostream> 07 #include <algorithm> 08 #include <functional> // for greater<T> 09 #include <list> 10 11 using namespace std; 12 13 int main() 14 { 15 16 list<int> lst{3, 15, 9, 11, 13, 15, 21}; 17 18 if(adjacent_find(lst.begin(), lst.end(), greater<int>{}) != lst.end()) // find a pair of elements out of order 19 cout << "The list lst is NOT sorted" << endl; 20 else 21 cout << "The list lst is sorted" << endl; 22 } 23 24 25 26