You have the begin
and end
iterators in the wrong order. You should call std::sort
as:
std::sort(JobPool.begin(), JobPool.end(), myobject);
Then you should make the comparator actually be one that works in reverse order:
struct myclass {
bool operator()(int i, int j) const { return j<i; }
} myobject;
Then you should notice that the standard library already supplies std::greater:
std::sort(JobPool.begin(), JobPool.end(), std::greater<int>());