| 379 | |
| 380 | template <class ForwardIt, class T> |
| 381 | sycl::event remove(sycl::queue &q, util::allocation_group &scratch_allocations, |
| 382 | ForwardIt first, ForwardIt last, const T &value, |
| 383 | std::size_t *num_elements_copied = nullptr, |
| 384 | const std::vector<sycl::event> &deps = {}) { |
| 385 | if(first == last) { |
| 386 | if(num_elements_copied) |
| 387 | *num_elements_copied = 0; |
| 388 | return sycl::event{}; |
| 389 | } |
| 390 | |
| 391 | T* device_buffer = scratch_allocations.obtain<T>(std::distance(first, last)); |
| 392 | |
| 393 | auto pred = [value](auto x){ return !(x == value); }; |
| 394 | auto evt = copy_if(q, scratch_allocations, first, last, device_buffer, pred, |
| 395 | num_elements_copied, deps); |
| 396 | |
| 397 | evt.wait(); |
| 398 | return copy_n(q, &(*device_buffer), *num_elements_copied, first, |
| 399 | deps); |
| 400 | } |
| 401 | |
| 402 | template <class ForwardIt, class UnaryPredicate> |
| 403 | sycl::event remove_if(sycl::queue &q, util::allocation_group &scratch_allocations, |