小编Adi*_*aru的帖子

C++ STL设置lower_bound错误结果

我对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)

c++ algorithm stl function lower-bound

2
推荐指数
1
解决办法
726
查看次数

标签 统计

algorithm ×1

c++ ×1

function ×1

lower-bound ×1

stl ×1