CTest类有2个成员变量:id1,id2。创建7个CTest对象:
数据是:
id1                 id2
0                   -1
79                  0
81                  0
82                  0
80                  1
83                  81
1                   82想排序的结果是:id1 == id2 的,就排在前。
即:
id1                 id2
0                   -1
79                  0
81                  0
83                  81
82                  0
1                   82
80                  1
我的排序条件是:
BOOL Rule(const CTest* pFirst, const CTest* pSecond)
{
if(pFirst->Getid1() == pSecond->Getid2())
return TRUE;
else
return FALSE;
}stable_sort(mVector.begin(), mVector.end(), Rule);
但排不到我想要的结果。排序条件应该怎样改?