I'm trying to sort a list of a custom struct type, with a custom function I have write, but give me an error:
Use of undeclared identifier
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
}
This is the error:
beacuse seem that expects input parameters...