thrust::universal_ptr#
-
template<typename T>
using thrust::universal_ptr = thrust::system::__THRUST_DEVICE_SYSTEM_NAMESPACE::universal_pointer<T># universal_ptrstores 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_ptrhas pointer semantics: it may be dereferenced safely from both hosts and devices and may be manipulated with pointer arithmetic.universal_ptrcan be created withuniversal_allocatoror by explicitly calling its constructor with a raw pointer.The raw pointer encapsulated by a
universal_ptrmay be obtained by either itsgetmethod or theraw_pointer_castfree function.See also
host_ptr For the documentation of the complete interface which is shared by
universal_ptr.See also
Note
universal_ptris not a smart pointer; it is the programmer’s responsibility to deallocate memory pointed to byuniversal_ptr.