You should use a functional object. Here is an example
#include
#include
#include
struct Compare
{
bool operator ()( const std::pair &p1,
const std::pair &p2 ) const
{
return ( p1.second - p1.first > p2.second - p2.first );
}
};
int main()
{
std::set, Compare> s;
return 0;
}