| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #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/system/detail/generic/generate.h> |
| #include <thrust/iterator/iterator_traits.h> |
| #include <thrust/detail/internal_functional.h> |
| #include <thrust/for_each.h> |
|
|
| THRUST_NAMESPACE_BEGIN |
| namespace system |
| { |
| namespace detail |
| { |
| namespace generic |
| { |
|
|
| template<typename ExecutionPolicy, |
| typename ForwardIterator, |
| typename Generator> |
| __host__ __device__ |
| void generate(thrust::execution_policy<ExecutionPolicy> &exec, |
| ForwardIterator first, |
| ForwardIterator last, |
| Generator gen) |
| { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| THRUST_STATIC_ASSERT_MSG( |
| !thrust::detail::is_const< |
| typename thrust::detail::remove_reference< |
| typename thrust::iterator_traits<ForwardIterator>::reference |
| >::type |
| >::value |
| , "generating to `const` iterators is not allowed" |
| ); |
| thrust::for_each(exec, first, last, typename thrust::detail::generate_functor<ExecutionPolicy,Generator>::type(gen)); |
| } |
|
|
| template<typename ExecutionPolicy, |
| typename OutputIterator, |
| typename Size, |
| typename Generator> |
| __host__ __device__ |
| OutputIterator generate_n(thrust::execution_policy<ExecutionPolicy> &exec, |
| OutputIterator first, |
| Size n, |
| Generator gen) |
| { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| THRUST_STATIC_ASSERT_MSG( |
| !thrust::detail::is_const< |
| typename thrust::detail::remove_reference< |
| typename thrust::iterator_traits<OutputIterator>::reference |
| >::type |
| >::value |
| , "generating to `const` iterators is not allowed" |
| ); |
| return thrust::for_each_n(exec, first, n, typename thrust::detail::generate_functor<ExecutionPolicy,Generator>::type(gen)); |
| } |
|
|
| } |
| } |
| } |
| THRUST_NAMESPACE_END |
|
|
|
|