8#ifndef ADOBE_ALGORITHM_BINARY_SEARCH_HPP
9#define ADOBE_ALGORITHM_BINARY_SEARCH_HPP
16#include <boost/range/begin.hpp>
17#include <boost/range/const_iterator.hpp>
18#include <boost/range/end.hpp>
19#include <boost/range/iterator.hpp>
28namespace implementation {
35inline I binary_search(I f, I l,
const T& x, C c, P p) {
37 if (result != l && p(*result) == x)
105 return implementation::binary_search(f, l, x, c, std::bind(p, std::placeholders::_1));
124template <
typename I,
typename T>
125inline typename boost::range_iterator<I>::type
binary_search(I& range,
const T& x) {
129template <
typename I,
typename T>
130inline typename boost::range_const_iterator<I>::type
binary_search(
const I& range,
const T& x) {
134template <
typename I,
typename T,
typename C>
135inline typename boost::range_iterator<I>::type
binary_search(I& range,
const T& x, C c) {
139template <
typename I,
typename T,
typename C>
140inline typename boost::range_const_iterator<I>::type
binary_search(
const I& range,
const T& x,
151inline typename boost::lazy_disable_if<std::is_same<I, T>, boost::range_iterator<I>>::type
162inline typename boost::lazy_disable_if<std::is_same<I, T>, boost::range_const_iterator<I>>::type
I binary_search(I f, I l, const T &x, C c, P p)
I lower_bound(I f, I l, const T &x)