| 869 | |
| 870 | template<class ForwardIt, class UnaryPredicate> |
| 871 | sycl::event count_if(sycl::queue &q, util::allocation_group &scratch_allocations, |
| 872 | ForwardIt first, ForwardIt last, |
| 873 | typename std::iterator_traits<ForwardIt>::difference_type *out, |
| 874 | UnaryPredicate p, const std::vector<sycl::event> &deps = {}) { |
| 875 | |
| 876 | using DiffT = typename std::iterator_traits<ForwardIt>::difference_type; |
| 877 | using ValueT = typename std::iterator_traits<ForwardIt>::value_type; |
| 878 | |
| 879 | return transform_reduce(q, scratch_allocations, first, last, out, |
| 880 | DiffT{}, std::plus<>{}, |
| 881 | [p](ValueT x) {return p(x) ? 1 : 0;}, |
| 882 | deps); |
| 883 | } |
| 884 | |
| 885 | template <class ForwardIt1, class ForwardIt2, class BinaryPredicate> |
| 886 | sycl::event mismatch(sycl::queue &q, util::allocation_group &scratch_allocations, |