std::lower_bound(it, end, v)
needs to be able to do both *it < v
and v < *it
. Your function object supports only one of these.
Since there is a comment on this, leaving the above statement: This isn't the case. As Howard pointed out, the comparison is required to use comp(*it, v)
, i.e., there is no need for this operation to be symmetric.
However, looking at the documentation of boost::zip_iterator<It0, It1>
it seems that *it
yields a boost::tuple<typename It0::reference, typename It1::reference>
. Thus, adding the typedef
typedef boost::tuple<typename std::vector<Key>::reference,
typename std::vector<Value>::reference> the_reference_tuple;
... and changing the lambda to become
[](the_reference_tuple const& it, int v) { return it.get<0>() < v; }
solves the compilation issues using gcc and clang.