thrust
|
◆ device_reference() [2/2]
template<typename T>
This copy constructor initializes this
The following code snippet demonstrates the semantic of this copy constructor. #include <thrust/device_vector.h> #include <assert.h> ... thrust::device_vector<int> v(1,0); thrust::device_ptr<int> ptr = &v[0]; thrust::device_reference<int> ref(ptr); // ref equals the object pointed to by ptr assert(ref == *ptr); // the address of ref equals ptr assert(&ref == ptr); // modifying *ptr modifies ref *ptr = 13; assert(ref == 13); References thrust::device_reference< T >::operator=(), and thrust::swap(). |