| 32 | /// \see count_if() |
| 33 | template<class InputIterator, class T> |
| 34 | inline size_t count(InputIterator first, |
| 35 | InputIterator last, |
| 36 | const T &value, |
| 37 | command_queue &queue = system::default_queue()) |
| 38 | { |
| 39 | BOOST_STATIC_ASSERT(is_device_iterator<InputIterator>::value); |
| 40 | typedef typename std::iterator_traits<InputIterator>::value_type value_type; |
| 41 | |
| 42 | using ::boost::compute::_1; |
| 43 | using ::boost::compute::lambda::all; |
| 44 | |
| 45 | if(vector_size<value_type>::value == 1){ |
| 46 | return ::boost::compute::count_if(first, |
| 47 | last, |
| 48 | _1 == value, |
| 49 | queue); |
| 50 | } |
| 51 | else { |
| 52 | return ::boost::compute::count_if(first, |
| 53 | last, |
| 54 | all(_1 == value), |
| 55 | queue); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | } // end compute namespace |
| 60 | } // end boost namespace |