#include #include using namespace std; #if 0 int max(list l) { // If there is only one element, that is the max if (l.size() == 1) return l.front(); // Otherwise, compare the value of the front element and // the max of the rest of the list int head = l.front(); l.pop_front(); int maxRest = max(l); if (maxRest > head) return maxRest; return head; } #endif int main() { list a; list b; a.push_back(110); a.push_back(712); a.push_back(110); a.push_back(712); a.push_back(110); a.push_back(712); a.push_back(110); a.push_back(712); a.push_back(316); a.push_back(17); a.push_back(-11); for (list::iterator i = a.begin(); i != a.end(); ++i) { cout << *i << endl; } cout << "uniquify a" << endl << endl; a.sort(); a.unique(); for (list::iterator i = a.begin(); i != a.end(); ++i) { cout << *i << endl; } }