File indexing completed on 2025-01-18 09:29:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_COMPUTE_ALGORITHM_UNIQUE_HPP
0012 #define BOOST_COMPUTE_ALGORITHM_UNIQUE_HPP
0013
0014 #include <boost/static_assert.hpp>
0015
0016 #include <boost/compute/system.hpp>
0017 #include <boost/compute/command_queue.hpp>
0018 #include <boost/compute/algorithm/unique_copy.hpp>
0019 #include <boost/compute/container/vector.hpp>
0020 #include <boost/compute/functional/operator.hpp>
0021 #include <boost/compute/type_traits/is_device_iterator.hpp>
0022
0023 namespace boost {
0024 namespace compute {
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 template<class InputIterator, class BinaryPredicate>
0041 inline InputIterator unique(InputIterator first,
0042 InputIterator last,
0043 BinaryPredicate op,
0044 command_queue &queue = system::default_queue())
0045 {
0046 BOOST_STATIC_ASSERT(is_device_iterator<InputIterator>::value);
0047 typedef typename std::iterator_traits<InputIterator>::value_type value_type;
0048
0049 vector<value_type> temp(first, last, queue);
0050
0051 return ::boost::compute::unique_copy(
0052 temp.begin(), temp.end(), first, op, queue
0053 );
0054 }
0055
0056
0057 template<class InputIterator>
0058 inline InputIterator unique(InputIterator first,
0059 InputIterator last,
0060 command_queue &queue = system::default_queue())
0061 {
0062 BOOST_STATIC_ASSERT(is_device_iterator<InputIterator>::value);
0063 typedef typename std::iterator_traits<InputIterator>::value_type value_type;
0064
0065 return ::boost::compute::unique(
0066 first, last, ::boost::compute::equal_to<value_type>(), queue
0067 );
0068 }
0069
0070 }
0071 }
0072
0073 #endif