#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
using namespace std;
template<class T>
void myPrint(const T &data)
{
typename T::const_iterator it;
for(it = data.begin(); it != data.end(); it++)
{
cout << *it << endl;
}
}
int main()
{
vector<int> v;
v.push_back(1);
v.push_back(5);
v.push_back(3);
v.push_back(4);
sort(v.begin(), v.end());
myPrint(v);
cout << "--------" << endl;
list<int> l;
l.push_back(1);
l.push_back(5);
l.push_back(3);
l.push_back(4);
l.reverse();
myPrint(l);
cout << "--------" << endl;
l.sort();
myPrint(l);
return 0;
}
$ ./a.out
1
3
4
5
--------
4
3
5
1
--------
1
3
4
5