我对lower_bound比较函数有一些问题.
我有一对由该对的第二个值排序的对,我试着通过一个值从这个集合中获取lower_bound.
我目前的代码是:
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
struct setCompareFunctor
{
bool operator( )( const pair< int, int > &lhs, const pair< int, int > &rhs ) const
{
return( lhs.second <= rhs.second );
}
};
struct setCompareFunctorAux
{
bool operator( )( const pair< int, int > &lhs, const pair< int, int > &rhs ) const
{
return( lhs.second <= rhs.second );
}
bool operator( )( const pair< int, int > &lhs, int val …Run Code Online (Sandbox Code Playgroud)