for_each_index

for_each_index#

stdgpu: stdgpu::for_each_index
stdgpu Latest
Efficient STL-like Data Structures on the GPU

◆ for_each_index()

template<typename IndexType , typename ExecutionPolicy , typename UnaryFunction , STDGPU_DETAIL_OVERLOAD_IF(is_execution_policy_v< remove_cvref_t< ExecutionPolicy > >) >
void stdgpu::for_each_index ( ExecutionPolicy &&  policy,
IndexType  size,
UnaryFunction  f 
)

Calls the given unary function with an index from the range [0, size)

Template Parameters
IndexTypeThe type of the index values
ExecutionPolicyThe type of the execution policy
UnaryFunctionThe type of the unary function
Parameters
[in]policyThe execution policy, e.g. host or device
[in]sizeThe number of indices, i.e. the upper bound of [0, size)
[in]fThe unary function to call with an index i