没有与较新的gcc调用'lower_bound'的匹配函数

问题描述:

我在编译具有较新版本的gcc的系统上使用std :: lower_bound的代码时遇到了一些麻烦。从我的测试中,4.1有效,但4.6失败。没有与较新的gcc调用'lower_bound'的匹配函数

下面是相关的代码片段:

template <typename RandomAccessIterator, typename Value, typename Comparer> 
int my_binary_search(RandomAccessIterator const first, RandomAccessIterator const last, Value const& value, Comparer comparer) 
{ 
    RandomAccessIterator it(std::lower_bound(first, last, value, comparer)); 
    //some more code below 
} 

我看到的错误是:

error: no matching function for call to ‘lower_bound(const __gnu_cxx::__normal_iterator<int*, std::vector<int> >&, const __gnu_cxx::__normal_iterator<int*, std::vector<int> >&, const int&, bool (*&)(int, int))’ 
testing.h:37:75: note: candidate is: 
/usr/include/c++/4.6/bits/stl_algobase.h:936:5: note: template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) 

是否有人对如何解决这个想法?

+0

你可以发布一个简短的自我包含的程序演示该问题? –

对于任何人在谷歌发现这样的: 我有同样的问题 包括了“功能性”和“名单”,没有给我任何错误LOWER_BOUND wasnt定义或任何东西,只是它无法找到一个匹配功能。

包括“算法”的伎俩..近了这样的傻事搜索周围的一个小时