Class thrust::device_vector
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 a device_vector
may vary dynamically; memory management is automatic. The memory associated with a device_vector
resides in the memory accessible to devices.
Inherits From: detail::vector_base< T, thrust::device_allocator< T > >
See:
#include <thrust/device_vector.h>
template <typename T, typename Alloc = thrust::device_allocator<T>> class thrust::device_vector { public: device_vector(void);
device_vector(const Alloc & alloc);
~device_vector(void);
explicit device_vector(size_type n);
explicit device_vector(size_type n, const Alloc & alloc);
explicit device_vector(size_type n, const value_type & value);
explicit device_vector(size_type n, const value_type & value, const Alloc & alloc);
device_vector(const device_vector & v);
device_vector(const device_vector & v, const Alloc & alloc);
device_vector(device_vector && v);
device_vector(device_vector && v, const Alloc & alloc);
device_vector & operator=(const device_vector & v);
device_vector & operator=(device_vector && v);
template <typename OtherT, typename OtherAlloc> explicit device_vector(const device_vector< OtherT, OtherAlloc > & v);
template <typename OtherT, typename OtherAlloc> device_vector & operator=(const device_vector< OtherT, OtherAlloc > & v);
template <typename OtherT, typename OtherAlloc> device_vector(const std::vector< OtherT, OtherAlloc > & v);
template <typename OtherT, typename OtherAlloc> device_vector & operator=(const std::vector< OtherT, OtherAlloc > & v);
template <typename OtherT, typename OtherAlloc> device_vector(const detail::vector_base< OtherT, OtherAlloc > & v);
template <typename OtherT, typename OtherAlloc> device_vector & operator=(const detail::vector_base< OtherT, OtherAlloc > & v);
device_vector(std::initializer_list< T > il);
device_vector(std::initializer_list< T > il, const Alloc & alloc);
device_vector & operator=(std::initializer_list< T > il);
template <typename InputIterator> device_vector(InputIterator first, InputIterator last);
template <typename InputIterator> device_vector(InputIterator first, InputIterator last, const Alloc & alloc); };
Member Functions
Function thrust::device_vector::device_vector
device_vector(void);
This constructor creates an empty device_vector
.
Function thrust::device_vector::device_vector
device_vector(const Alloc & alloc);
This constructor creates an empty device_vector
.
Function Parameters: alloc
: The allocator to use by this device_vector.
Function thrust::device_vector::~device_vector
~device_vector(void);
The destructor erases the elements.
Function thrust::device_vector::device_vector
explicit device_vector(size_type n);
This constructor creates a device_vector
with the given size.
Function Parameters: n
: The number of elements to initially create.
Function thrust::device_vector::device_vector
explicit device_vector(size_type n, const Alloc & alloc);
This constructor creates a device_vector
with the given size.
Function Parameters:
n
The number of elements to initially create.alloc
The allocator to use by this device_vector.
Function thrust::device_vector::device_vector
explicit device_vector(size_type n, const value_type & value);
This constructor creates a device_vector
with copies of an exemplar element.
Function Parameters:
n
The number of elements to initially create.value
An element to copy.
Function thrust::device_vector::device_vector
explicit device_vector(size_type n, const value_type & value, const Alloc & alloc);
This constructor creates a device_vector
with copies of an exemplar element.
Function Parameters:
n
The number of elements to initially create.value
An element to copy.alloc
The allocator to use by this device_vector.
Function thrust::device_vector::device_vector
device_vector(const device_vector & v);
Copy constructor copies from an exemplar device_vector
.
Function Parameters: v
: The device_vector
to copy.
Function thrust::device_vector::device_vector
device_vector(const device_vector & v, const Alloc & alloc);
Copy constructor copies from an exemplar device_vector
.
Function Parameters:
v
Thedevice_vector
to copy.alloc
The allocator to use by this device_vector.
Function thrust::device_vector::device_vector
device_vector(device_vector && v);
Move constructor moves from another device_vector
.
Function Parameters: v
: The device_vector to move.
Function thrust::device_vector::device_vector
device_vector(device_vector && v, const Alloc & alloc);
Move constructor moves from another device_vector
.
Function Parameters:
v
The device_vector to move.alloc
The allocator to use by this device_vector.
Function thrust::device_vector::operator=
device_vector & operator=(const device_vector & v);
Copy assign operator copies another device_vector
with the same type.
Function Parameters: v
: The device_vector
to copy.
Function thrust::device_vector::operator=
device_vector & operator=(device_vector && v);
Move assign operator moves from another device_vector
.
Function Parameters: v
: The device_vector to move.
Function thrust::device_vector::device_vector
template <typename OtherT, typename OtherAlloc> explicit device_vector(const device_vector< OtherT, OtherAlloc > & v);
Copy constructor copies from an exemplar device_vector
with different type.
Function Parameters: v
: The device_vector
to copy.
Function thrust::device_vector::operator=
template <typename OtherT, typename OtherAlloc> device_vector & operator=(const device_vector< OtherT, OtherAlloc > & v);
Assign operator copies from an exemplar device_vector
with different type.
Function Parameters: v
: The device_vector
to copy.
Function thrust::device_vector::device_vector
template <typename OtherT, typename OtherAlloc> device_vector(const std::vector< OtherT, OtherAlloc > & v);
Copy constructor copies from an exemplar std::vector
.
Function Parameters: v
: The std::vector
to copy.
Function thrust::device_vector::operator=
template <typename OtherT, typename OtherAlloc> device_vector & operator=(const std::vector< OtherT, OtherAlloc > & v);
Assign operator copies from an exemplar std::vector
.
Function Parameters: v
: The std::vector
to copy.
Function thrust::device_vector::device_vector
template <typename OtherT, typename OtherAlloc> device_vector(const detail::vector_base< OtherT, OtherAlloc > & v);
Copy construct from a vector_base
whose element type is convertible to T
.
Function Parameters: v
: The vector_base
to copy.
Function thrust::device_vector::operator=
template <typename OtherT, typename OtherAlloc> device_vector & operator=(const detail::vector_base< OtherT, OtherAlloc > & v);
Assign a vector_base
whose element type is convertible to T
.
Function Parameters: v
: The vector_base
to copy.
Function thrust::device_vector::device_vector
device_vector(std::initializer_list< T > il);
This constructor builds a device_vector
from an intializer_list.
Function Parameters: il
: The intializer_list.
Function thrust::device_vector::device_vector
device_vector(std::initializer_list< T > il, const Alloc & alloc);
This constructor builds a device_vector
from an intializer_list.
Function Parameters:
il
The intializer_list.alloc
The allocator to use by this device_vector.
Function thrust::device_vector::operator=
device_vector & operator=(std::initializer_list< T > il);
Assign an intializer_list
with a matching element type
Function Parameters: il
: The intializer_list.
Function thrust::device_vector::device_vector
template <typename InputIterator> device_vector(InputIterator first, InputIterator last);
This constructor builds a device_vector
from a range.
Function Parameters:
first
The beginning of the range.last
The end of the range.
Function thrust::device_vector::device_vector
template <typename InputIterator> device_vector(InputIterator first, InputIterator last, const Alloc & alloc);
This constructor builds a device_vector
from a range.
Function Parameters:
first
The beginning of the range.last
The end of the range.alloc
The allocator to use by this device_vector.