Hi,
I have a problem with qSort, illustrated as follows:
#include <qhash.h>
struct TDATA {
float salary;
};
QHash < uint, TDATA> emps;
bool salaryLessThan(const TDATA &e1, const TDATA &e2) {
return (e1.salary < e2.salary);
}
int main(int argc, char *argv[])
{
qStableSort(emps.begin(), emps.end(), salaryLessThan);
return 1;
}
#include <qhash.h>
struct TDATA {
QString emp_name;
float salary;
};
QHash < uint, TDATA> emps;
bool salaryLessThan(const TDATA &e1, const TDATA &e2) {
return (e1.salary < e2.salary);
}
int main(int argc, char *argv[])
{
qStableSort(emps.begin(), emps.end(), salaryLessThan);
return 1;
}
To copy to clipboard, switch view to plain text mode
Basically, I want to sort based on the values in the Hash.
Compiling this gives a long error message as attached:
Can anyone please help me out?
Thanks.
Bookmarks