Drop Cast
Note
The C++ API provides RAII wrappers around the C API. For detailed documentation including parameters, return values, and limitations, please refer to the corresponding C API documentation.
- template<int N, typename T, class = Require<HasEnoughComponents<T, N>>> __host__ __device__ auto DropCast (T v)
Metafunction to drop components of a compound value.
The template parameter
Ndefines the number of components to cast the CUDA compound typeTpassed as function argumentv. This is done by dropping the last components afterNfromv. 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 typeTis not needed as it is inferred from the argumentv. It is a requirement of the DropCast function that the typeThas at least N components.uint2 dstIdx = DropCast<2>(blockIdx * blockDim + threadIdx);
- Template Parameters:
N – Number of components to return.
- Parameters:
v – [in] Value to drop components from.
- Returns:
The compound value with N components dropping the last, extra components.