Well, it make_heaphas an overload that accepts an additional comparison operator, soo ...
typedef std::pair<std::string, int> myPair_type;
struct mypair_comp{
bool operator()(myPair_type const& lhs, myPair_type const& rhs){
return lhs.second < rhs.second;
}
};
make_heap(first,last,mypair_comp());
source
share