Can't compile std::map sorting, why?
- by Vincenzo
This is my code:
map<string, int> errs;
struct Compare {
    bool operator() (map<string, int>::const_iterator l, 
        map<string, int>::const_iterator r) { 
        return ((*l).second < (*r).second); 
    }
} comp;
sort(errs.begin(), errs.end(), comp);
Can't compile. This is what I'm getting:
no matching function for call to ‘sort(..’
Why so? Can anyone help? Thanks!