I would like to partial sort this vector with a predicate as such
std::vector<std::pair<std::string, int>> vp;
std::partial_sort(vp.begin(), vp.begin()+10, [](const std::pair<std::string,int> &left, const std::pair<std::string,int> &right)
{
return left.second > right.second;
});
However I get the error
no matching function for call to ‘partial_sort(std::vector<std::pair<std::basic_string<char>, int> >::iterator, __gnu_cxx::__normal_iterator<std::pair<std::basic_string<char>, int>*, ....
The above works fine for std::sort and not for partial_sort any suggestions ?
...? Does it list candidate functions considered and reasons why they were not applicable?partial_sortrequires three iterators? (I only see two.)