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