◆ universal_ptr

template<typename T >
using thrust::universal_ptr = typedef 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 with universal_allocator or by explicitly calling its constructor with a raw pointer.

The raw pointer encapsulated by a universal_ptr may be obtained by either its get method or the raw_pointer_cast free function.

universal_ptr is not a smart pointer; it is the programmer's responsibility to deallocate memory pointed to by universal_ptr.
See also
host_ptr For the documentation of the complete interface which is shared by universal_ptr.