8#ifndef ADOBE_ALGORITHM_UPPER_BOUND_HPP
9#define ADOBE_ALGORITHM_UPPER_BOUND_HPP
19#include <boost/next_prior.hpp>
20#include <boost/range/begin.hpp>
21#include <boost/range/end.hpp>
22#include <boost/utility/enable_if.hpp>
29namespace implementation {
39I upper_bound_n(I f, N n,
const T& x, C c, P p) {
40 assert(!(n < 0) &&
"FATAL (sparent) : n must be >= 0");
45 I m = boost::next(f, h);
89 return implementation::upper_bound_n(
90 f, n, x, std::bind(c, std::placeholders::_1, std::placeholders::_2),
identity<T>());
102 return implementation::upper_bound_n(f, n, x,
103 std::bind(c, std::placeholders::_1, std::placeholders::_2),
104 std::bind(p, std::placeholders::_1));
125 return std::upper_bound(f, l, x);
135 return std::upper_bound(f, l, x, std::bind(c, std::placeholders::_1, std::placeholders::_2));
155inline typename boost::lazy_disable_if<std::is_same<I, T>, boost::range_iterator<I>>
::type
166inline typename boost::lazy_disable_if<std::is_same<I, T>, boost::range_const_iterator<I>>
::type
177template <
class ForwardRange,
class T>
178inline typename boost::range_iterator<ForwardRange>::type
upper_bound(ForwardRange& range,
180 return std::upper_bound(boost::begin(range), boost::end(range), value);
188template <
class ForwardRange,
class T>
189inline typename boost::range_const_iterator<ForwardRange>::type
191 return std::upper_bound(boost::begin(range), boost::end(range), value);
204template <
typename I,
class T,
class Compare>
205inline typename boost::lazy_disable_if<std::is_same<I, T>, boost::range_iterator<I>>
::type
215template <
class I,
class T,
class Compare>
216inline typename boost::lazy_disable_if<std::is_same<I, T>, boost::range_const_iterator<I>>
::type
I upper_bound(I f, I l, const T &x)
I upper_bound_n(I f, N n, const T &x)