#include
#include
#include
class Integer
{
public:
int m;
Integer(int a):m(a){};
};
class CompareParts
#include
#include
#include
class Integer
{
public:
int m;
Integer(int a):m(a){};
};
class CompareParts
{
public:
bool operator()(const Integer & p1,const Integer & p2)
{
return p1.m
}
};
int main()
{
std::vector vecInteger;
vecInteger.push_back(Integer(12));
vecInteger.push_back(Integer(13));
vecInteger.push_back(Integer(5));
vecInteger.push_back(Integer(7));
vecInteger.push_back(Integer(9));
std::sort(vecInteger.begin(),vecInteger.end(),CompareParts());
typedef vector::const_iterator Iter;
Iter beg = vecInteger.begin();
Iter end = vecInteger.end();
for (Iter iter = beg; iter != end; ++iter)
cout << (*iter).m << " ";
cout << endl;
}
Output: 5 7 9 12 13