Drop Cast

group NVCV_CPP_CUDATOOLS_DROPCAST

Metafunction to drop components of a compound value.

The template parameter N defines the number of components to cast the CUDA compound type T passed as function argument v. This is done by dropping the last components after N from v. For instance, an uint3 can have its z component dropped by passing it as function argument to DropCast and the number 2 as template argument (see example below). The type T is not needed as it is inferred from the argument v. It is a requirement of the DropCast function that the type T has at least N components.

uint2 dstIdx = DropCast<2>(blockIdx * blockDim + threadIdx);
tparam N:

Number of components to return.

param v:

[in] Value to drop components from.

return:

The compound value with N components dropping the last, extra components.

Functions

template<int N, typename T, class = Require<HasEnoughComponents<T, N>>> __host__ __device__ auto DropCast (T v)