Template Class device_vector¶
Defined in File device_vector.h
Class Documentation¶
-
template<typename
T
, typenameAlloc
= thrust::device_malloc_allocator<T>>
classdevice_vector
: public detail::vector_base<T, Alloc>¶ A
device_vector
is a container that supports random access to elements, constant time removal of elements at the end, and linear time insertion and removal of elements at the beginning or in the middle. The number of elements in adevice_vector
may vary dynamically; memory management is automatic. The memory associated with adevice_vector
resides in the memory space of a parallel device.Public Functions
-
__host__
device_vector
(void)¶ This constructor creates an empty
device_vector
.
-
__host__
~device_vector
(void)¶ The destructor erases the elements.
-
__host__
device_vector
(size_type n)¶ This constructor creates a
device_vector
with the given size.- Parameters
n
: The number of elements to initially create.
-
__host__
device_vector
(size_type n, const value_type &value)¶ This constructor creates a
device_vector
with copies of an exemplar element.- Parameters
n
: The number of elements to initially create.value
: An element to copy.
-
__host__
device_vector
(const device_vector &v)¶ Copy constructor copies from an exemplar
device_vector
.- Parameters
v
: Thedevice_vector
to copy.
-
__host__ device_vector& thrust::device_vector::operator=(const device_vector & v)
Copy assign operator copies another
device_vector
with the same type.- Parameters
v
: Thedevice_vector
to copy.
-
template<typename OtherT, typename OtherAlloc>__host__ __device__ thrust::device_vector::device_vector(const device_vector < OtherT, OtherAlloc > & v)
Copy constructor copies from an exemplar
device_vector
with different type.- Parameters
v
: Thedevice_vector
to copy.
-
template<typename OtherT, typename OtherAlloc>__host__ device_vector& thrust::device_vector::operator=(const device_vector < OtherT, OtherAlloc > & v)
Assign operator copies from an exemplar
device_vector
with different type.- Parameters
v
: Thedevice_vector
to copy.
-
template<typename
OtherT
, typenameOtherAlloc
>
__host__device_vector
(const std::vector<OtherT, OtherAlloc> &v)¶ Copy constructor copies from an exemplar
std::vector
.- Parameters
v
: Thestd::vector
to copy.
-
template<typename OtherT, typename OtherAlloc>__host__ device_vector& thrust::device_vector::operator=(const std::vector< OtherT, OtherAlloc > & v)
Assign operator copies from an exemplar
std::vector
.- Parameters
v
: Thestd::vector
to copy.
-
template<typename
OtherT
, typenameOtherAlloc
>
__host__device_vector
(const host_vector<OtherT, OtherAlloc> &v)¶ Copy constructor copies from an exemplar
host_vector
with possibly different type.- Parameters
v
: Thehost_vector
to copy.
-
template<typename OtherT, typename OtherAlloc>__host__ device_vector& thrust::device_vector::operator=(const host_vector < OtherT, OtherAlloc > & v)
Assign operator copies from an examplar
host_vector
.- Parameters
v
: Thehost_vector
to copy.
-
template<typename
InputIterator
>
__host__device_vector
(InputIterator first, InputIterator last)¶ This constructor builds a
device_vector
from a range.- Parameters
first
: The beginning of the range.last
: The end of the range.
-
__host__