]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/compute/algorithm/equal_range.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / compute / algorithm / equal_range.hpp
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
16 #include <boost/compute/system.hpp>
17 #include <boost/compute/command_queue.hpp>
18 #include <boost/compute/algorithm/lower_bound.hpp>
19 #include <boost/compute/algorithm/upper_bound.hpp>
20
21 namespace boost {
22 namespace compute {
23
24 /// Returns a pair of iterators containing the range of values equal
25 /// to \p value in the sorted range [\p first, \p last).
26 ///
27 /// Space complexity: \Omega(1)
28 template<class InputIterator, class T>
29 inline std::pair<InputIterator, InputIterator>
30 equal_range(InputIterator first,
31 InputIterator last,
32 const T &value,
33 command_queue &queue = system::default_queue())
34 {
35 return std::make_pair(
36 ::boost::compute::lower_bound(first, last, value, queue),
37 ::boost::compute::upper_bound(first, last, value, queue)
38 );
39 }
40
41 } // end compute namespace
42 } // end boost namespace
43
44 #endif // BOOST_COMPUTE_ALGORITHM_EQUAL_RANGE_HPP