Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22192

no matching function for call to 'lower_bound' with newer gcc

$
0
0

I'm having some trouble compiling code that uses std::lower_bound on systems with newer versions of gcc. From my tests, 4.1 works, but 4.6 fails.

Here is the relevant code snippet:

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}

The error I am seeing is:

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&)

Does anybody have ideas on how to fix this?


Viewing all articles
Browse latest Browse all 22192


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>