Variable nvcv::cuda::NumElements

Variable Documentation

template<class T, class = Require<HasTypeTraits<T>>>
constexpr int nvcv::cuda::NumElements = TypeTraits<T>::elements

Metavariable to get the number of elements of a type.

using DataType = ...;
for (int e = 0; e < nvcv::cuda::NumElements<DataType>; ++e)
    // ...

Note

This is one for regular C types and one to four for CUDA compound types.

Template Parameters:

T – Type to get the number of elements from.