Demonstrating the STL list unique functions
#include <iostream>
#include <cassert>
#include <string>
#include <list>
using namespace std;
int main()
{
string s("Stroustrup");
list<char> list1(s.begin(), s.end());
list1.sort();
list1.unique();
list<char>::iterator i;
for (i = list1.begin(); i != list1.end(); ++i)
cout << *i;
return 0;
}
/*
Soprstu
*/
Related examples in the same category