#include <list>
#include <algorithm>
#include <time.h>
using namespace std;
typedef struct mystruct
{
int a;
int b;
}mystruct;
template<>
struct std::greater<mystruct>
{
bool operator()( mystruct X, mystruct Y) const
{
return X.a == Y.a ? X.b < Y.b : X.a < Y.a;
}
};
void main()
{
list<mystruct> data;
srand((unsigned)time(NULL));
mystruct StrInfo;
for (int i =0; i < 10 ; i ++)
{
StrInfo.a = 1 + rand() % 10;
StrInfo.b = 1 + rand() % 10;
data.push_back(StrInfo);
}
data.sort(greater<mystruct>());
return;
}