Speclib  0.1.2
The library for writing better CUDA libraries
sp::IndirectScalar< T > Class Template Reference

A self-dereferencing pointer. More...

#include <CudaScalar.hpp>

Public Types

using ValueType = T
 

Public Member Functions

 IndirectScalar (const T *value)
 
 operator T () const
 

Detailed Description

template<typename T>
class sp::IndirectScalar< T >

A self-dereferencing pointer.

Some CUDA APIs like to encode scalars as pointers. It is, therefore, convenient to have this little struct that holds a pointer that we can pretend isn't a pointer at all (by allowing it to implicitly dereference itself). This, in turn, can be stuffed into sp::Scalar by the specialisation engine when it fails to select a more efficient option (such as dereferencing the pointer on the host - if it's a host pointer).

The only sane application for this struct is when writing API glue for weird C APIs.