关于lower_bound的优先级重载

今天才知道$lower\_bound$最后有一个优先级参数……

首先$lower\_bound$中的优先级和序列优先级必须相同才有效

$lower\_bound$中优先级默认的是小于号,也就是说仅当序列从小到大排序时才有效

可以选择重载小括号/小于号,或者直接写$bool$函数

bool cmp (int a,int b)
{return a>b;}
struct cmp
{
    bool operator () (int a,int b)
    {return a>b;}
};

如果是结构体写法调用时要记得加括号

原文地址:https://www.cnblogs.com/newera/p/9583046.html