]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/compute/algorithm/equal_range.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / compute / algorithm / equal_range.hpp
CommitLineData
7c673cae
FG
1//---------------------------------------------------------------------------//
2// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
3//
4// Distributed under the Boost Software License, Version 1.0
5// See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt
7//
8// See http://boostorg.github.com/compute for more information.
9//---------------------------------------------------------------------------//
10
11#ifndef BOOST_COMPUTE_ALGORITHM_EQUAL_RANGE_HPP
12#define BOOST_COMPUTE_ALGORITHM_EQUAL_RANGE_HPP
13
14#include <utility>
15
92f5a8d4
TL
16#include <boost/static_assert.hpp>
17
7c673cae
FG
18#include <boost/compute/system.hpp>
19#include <boost/compute/command_queue.hpp>
20#include <boost/compute/algorithm/lower_bound.hpp>
21#include <boost/compute/algorithm/upper_bound.hpp>
92f5a8d4 22#include <boost/compute/type_traits/is_device_iterator.hpp>
7c673cae
FG
23
24namespace boost {
25namespace compute {
26
27/// Returns a pair of iterators containing the range of values equal
28/// to \p value in the sorted range [\p first, \p last).
b32b8144
FG
29///
30/// Space complexity: \Omega(1)
7c673cae
FG
31template<class InputIterator, class T>
32inline std::pair<InputIterator, InputIterator>
33equal_range(InputIterator first,
34 InputIterator last,
35 const T &value,
36 command_queue &queue = system::default_queue())
37{
92f5a8d4 38 BOOST_STATIC_ASSERT(is_device_iterator<InputIterator>::value);
7c673cae
FG
39 return std::make_pair(
40 ::boost::compute::lower_bound(first, last, value, queue),
41 ::boost::compute::upper_bound(first, last, value, queue)
42 );
43}
44
45} // end compute namespace
46} // end boost namespace
47
48#endif // BOOST_COMPUTE_ALGORITHM_EQUAL_RANGE_HPP