我正在尝试upper_bound在 a 上使用vector<pair<int,int>>,如下所示:
vector<pair<int,int>> data;
auto up = upper_bound(data.begin(), data.end(), 0);
VS2012 给我以下错误:
error C2784: 'bool std::operator <(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::vector<_Ty,_Alloc> &' from 'const int'
为什么要尝试将 aconst int与 a进行比较pair<int,int>?
我尝试编写自己的比较函数,但它并没有改变任何东西。如果我这样做,编译器会尝试将 a 转换pair<int,int>为 a 。const int