universal_ptr
#
-
template<typename T>
using thrust::universal_ptr = thrust::system::__THRUST_DEVICE_SYSTEM_NAMESPACE::universal_pointer<T># universal_ptr
stores a pointer to an object allocated in memory accessible to both hosts and devices.Algorithms dispatched with this type of pointer will be dispatched to either host or device, depending on which backend you are using. Explicit policies (
thrust::device
, etc) can be used to specify where an algorithm should be run.universal_ptr
has pointer semantics: it may be dereferenced safely from both hosts and devices and may be manipulated with pointer arithmetic.universal_ptr
can be created withuniversal_allocator
or by explicitly calling its constructor with a raw pointer.The raw pointer encapsulated by a
universal_ptr
may be obtained by either itsget
method or theraw_pointer_cast
free function.See also
host_ptr For the documentation of the complete interface which is shared by
universal_ptr
.See also
Note
universal_ptr
is not a smart pointer; it is the programmer’s responsibility to deallocate memory pointed to byuniversal_ptr
.