Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:56

0001 //---------------------------------------------------------------------------//
0002 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
0003 //
0004 // Distributed under the Boost Software License, Version 1.0
0005 // See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt
0007 //
0008 // See http://boostorg.github.com/compute for more information.
0009 //---------------------------------------------------------------------------//
0010 
0011 #ifndef BOOST_COMPUTE_ALGORITHM_EQUAL_RANGE_HPP
0012 #define BOOST_COMPUTE_ALGORITHM_EQUAL_RANGE_HPP
0013 
0014 #include <utility>
0015 
0016 #include <boost/static_assert.hpp>
0017 
0018 #include <boost/compute/system.hpp>
0019 #include <boost/compute/command_queue.hpp>
0020 #include <boost/compute/algorithm/lower_bound.hpp>
0021 #include <boost/compute/algorithm/upper_bound.hpp>
0022 #include <boost/compute/type_traits/is_device_iterator.hpp>
0023 
0024 namespace boost {
0025 namespace compute {
0026 
0027 /// Returns a pair of iterators containing the range of values equal
0028 /// to \p value in the sorted range [\p first, \p last).
0029 ///
0030 /// Space complexity: \Omega(1)
0031 template<class InputIterator, class T>
0032 inline std::pair<InputIterator, InputIterator>
0033 equal_range(InputIterator first,
0034             InputIterator last,
0035             const T &value,
0036             command_queue &queue = system::default_queue())
0037 {
0038     BOOST_STATIC_ASSERT(is_device_iterator<InputIterator>::value);
0039     return std::make_pair(
0040                ::boost::compute::lower_bound(first, last, value, queue),
0041                ::boost::compute::upper_bound(first, last, value, queue)
0042            );
0043 }
0044 
0045 } // end compute namespace
0046 } // end boost namespace
0047 
0048 #endif // BOOST_COMPUTE_ALGORITHM_EQUAL_RANGE_HPP