File indexing completed on 2025-01-18 09:29:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_COMPUTE_ALGORITHM_FIND_HPP
0012 #define BOOST_COMPUTE_ALGORITHM_FIND_HPP
0013
0014 #include <boost/static_assert.hpp>
0015
0016 #include <boost/compute/lambda.hpp>
0017 #include <boost/compute/system.hpp>
0018 #include <boost/compute/command_queue.hpp>
0019 #include <boost/compute/algorithm/find_if.hpp>
0020 #include <boost/compute/type_traits/vector_size.hpp>
0021 #include <boost/compute/type_traits/is_device_iterator.hpp>
0022
0023 namespace boost {
0024 namespace compute {
0025
0026
0027
0028
0029
0030 template<class InputIterator, class T>
0031 inline InputIterator find(InputIterator first,
0032 InputIterator last,
0033 const T &value,
0034 command_queue &queue = system::default_queue())
0035 {
0036 BOOST_STATIC_ASSERT(is_device_iterator<InputIterator>::value);
0037 typedef typename std::iterator_traits<InputIterator>::value_type value_type;
0038
0039 using ::boost::compute::_1;
0040 using ::boost::compute::lambda::all;
0041
0042 if(vector_size<value_type>::value == 1){
0043 return ::boost::compute::find_if(
0044 first,
0045 last,
0046 _1 == value,
0047 queue
0048 );
0049 }
0050 else {
0051 return ::boost::compute::find_if(
0052 first,
0053 last,
0054 all(_1 == value),
0055 queue
0056 );
0057 }
0058 }
0059
0060 }
0061 }
0062
0063 #endif