| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #pragma once |
|
|
| #include <thrust/detail/config.h> |
|
|
| #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) |
| # pragma GCC system_header |
| #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) |
| # pragma clang system_header |
| #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) |
| # pragma system_header |
| #endif |
| #include <thrust/for_each.h> |
| #include <thrust/iterator/iterator_traits.h> |
| #include <thrust/system/detail/generic/select_system.h> |
| #include <thrust/system/detail/generic/for_each.h> |
| #include <thrust/system/detail/adl/for_each.h> |
|
|
| THRUST_NAMESPACE_BEGIN |
| |
| __thrust_exec_check_disable__ |
| template<typename DerivedPolicy, |
| typename InputIterator, |
| typename UnaryFunction> |
| __host__ __device__ |
| InputIterator for_each(const thrust::detail::execution_policy_base<DerivedPolicy> &exec, |
| InputIterator first, |
| InputIterator last, |
| UnaryFunction f) |
| { |
| using thrust::system::detail::generic::for_each; |
|
|
| return for_each(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first, last, f); |
| } |
|
|
|
|
| template<typename InputIterator, |
| typename UnaryFunction> |
| InputIterator for_each(InputIterator first, |
| InputIterator last, |
| UnaryFunction f) |
| { |
| using thrust::system::detail::generic::select_system; |
| typedef typename thrust::iterator_system<InputIterator>::type System; |
|
|
| System system; |
| return thrust::for_each(select_system(system), first, last, f); |
| } |
|
|
| __thrust_exec_check_disable__ |
| template<typename DerivedPolicy, typename InputIterator, typename Size, typename UnaryFunction> |
| __host__ __device__ |
| InputIterator for_each_n(const thrust::detail::execution_policy_base<DerivedPolicy> &exec, |
| InputIterator first, |
| Size n, |
| UnaryFunction f) |
| { |
| using thrust::system::detail::generic::for_each_n; |
|
|
| return for_each_n(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first, n, f); |
| } |
|
|
|
|
| template<typename InputIterator, |
| typename Size, |
| typename UnaryFunction> |
| InputIterator for_each_n(InputIterator first, |
| Size n, |
| UnaryFunction f) |
| { |
| using thrust::system::detail::generic::select_system; |
|
|
| typedef typename thrust::iterator_system<InputIterator>::type System; |
|
|
| System system; |
| return thrust::for_each_n(select_system(system), first, n, f); |
| } |
|
|
| THRUST_NAMESPACE_END |
|
|