]>
Commit | Line | Data |
---|---|---|
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 | ||
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 | template<class InputIterator, class T> | |
27 | inline std::pair<InputIterator, InputIterator> | |
28 | equal_range(InputIterator first, | |
29 | InputIterator last, | |
30 | const T &value, | |
31 | command_queue &queue = system::default_queue()) | |
32 | { | |
33 | return std::make_pair( | |
34 | ::boost::compute::lower_bound(first, last, value, queue), | |
35 | ::boost::compute::upper_bound(first, last, value, queue) | |
36 | ); | |
37 | } | |
38 | ||
39 | } // end compute namespace | |
40 | } // end boost namespace | |
41 | ||
42 | #endif // BOOST_COMPUTE_ALGORITHM_EQUAL_RANGE_HPP |