私が書いたカスタム関数を使用して、カスタム構造体型のリストをソートしようとしていますが、エラーが発生します:
宣言されていない識別子の使用
struct myStruct
{
int x1;
int x2;
};
bool CompareData(const myStruct& a, const myStruct& b)
{
if (a.x1 < b.x1) return true;
if (b.x1 < a.x1) return false;
// a=b for primary condition, go to secondary
if (a.x2 < b.x2) return true;
if (b.x2 < a.x2) return false;
return false;
}
void sortingList ()
{
std::list<myStruct> custom_dist;
//...Fill list
custom_dist.sort(CompareData); //Here i receive the error
}
これはエラーです:
入力パラメーターを期待しているように見えるため...