Sort list using stl sort function

Posted by Vlad on Stack Overflow See other posts from Stack Overflow or by Vlad
Published on 2010-03-12T13:07:38Z Indexed on 2010/03/12 13:27 UTC
Read the original article Hit count: 618

Filed under:
|
|
|

I'm trying to sort a list (part of a class) in descending containg items of a struct but it doesn't compile(error: no match for 'operator-' in '__last - __first'):

sort(Result.poly.begin(), Result.poly.end(), SortDescending());

And here's SortDescending:

 struct SortDescending
{
    bool operator()(const term& t1, const term& t2)
    { 
        return t2.pow < t1.pow; 
    }
};

Can anyone tell me what's wrong?

Thanks!

© Stack Overflow or respective owner

Related posts about c++

Related posts about sort