8#ifndef ADOBE_ALGORITHM_EQUAL_RANGE_HPP
9#define ADOBE_ALGORITHM_EQUAL_RANGE_HPP
19#include <boost/next_prior.hpp>
20#include <boost/range/begin.hpp>
21#include <boost/range/end.hpp>
40namespace implementation {
50std::pair<I, I> equal_range_n(I f, N n,
const T& x, C c, P p) {
51 assert(!(n < 0) &&
"FATAL (sparent) : n must be >= 0");
55 I m = boost::next(f, h);
60 }
else if (c(x, p(*m))) {
63 return std::make_pair(
64 implementation::lower_bound_n_(f, h, x, c, p),
65 implementation::upper_bound_n(boost::next(m), n - (h + 1), x, c, p));
68 return std::make_pair(f, f);
75 typedef std::pair<typename boost::range_iterator<I>::type,
76 typename boost::range_iterator<I>::type>
83struct lazy_range_const {
84 typedef std::pair<typename boost::range_const_iterator<I>::type,
85 typename boost::range_const_iterator<I>::type>
119 return implementation::equal_range_n(
120 f, n, x, std::bind(c, std::placeholders::_1, std::placeholders::_2),
identity<T>());
136 return implementation::equal_range_n(f, n, x,
137 std::bind(c, std::placeholders::_1, std::placeholders::_2),
138 std::bind(p, std::placeholders::_1));
151 return std::equal_range(f, l, x);
165 return std::equal_range(f, l, x, std::bind(c, std::placeholders::_1, std::placeholders::_2));
179inline std::pair<I, I>
equal_range(I f, I l,
const T& x, C c, P p) {
193inline typename boost::lazy_disable_if<std::is_same<I, T>, implementation::lazy_range<I>>::type
209 typename boost::lazy_disable_if<std::is_same<I, T>, implementation::lazy_range_const<I>>::type
222inline std::pair<typename boost::range_iterator<I>::type,
typename boost::range_iterator<I>::type>
224 return std::equal_range(boost::begin(r), boost::end(r), x);
235inline std::pair<typename boost::range_const_iterator<I>::type,
236 typename boost::range_const_iterator<I>::type>
238 return std::equal_range(boost::begin(r), boost::end(r), x);
250inline typename boost::lazy_disable_if<std::is_same<I, T>, implementation::lazy_range<I>>::type
265 typename boost::lazy_disable_if<std::is_same<I, T>, implementation::lazy_range_const<I>>::type
std::pair< I, I > equal_range_n(I f, N n, const T &x)
std::pair< I, I > equal_range(I f, I l, const T &x)