| 95 | |
| 96 | template <class ForwardIt, class UnaryFunction2> |
| 97 | sycl::event for_each(sycl::queue &q, ForwardIt first, ForwardIt last, |
| 98 | UnaryFunction2 f, |
| 99 | const std::vector<sycl::event> &deps = {}) { |
| 100 | if(first == last) |
| 101 | return sycl::event{}; |
| 102 | return q.parallel_for(sycl::range{std::distance(first, last)}, deps, |
| 103 | [=](sycl::id<1> id) { |
| 104 | auto it = first; |
| 105 | std::advance(it, id[0]); |
| 106 | f(*it); |
| 107 | }); |
| 108 | } |
| 109 | |
| 110 | template <class ForwardIt, class Size, class UnaryFunction2> |
| 111 | sycl::event for_each_n(sycl::queue &q, ForwardIt first, Size n, |