thrust::device_vector
Defined in thrust/device_vector.h
- 
template<typename T, typename Alloc = thrust::device_allocator<T>>
 class device_vector : public detail::vector_base<T, thrust::device_allocator<T>>
- A - device_vectoris 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_vectormay vary dynamically; memory management is automatic. The memory associated with a- device_vectorresides in the memory accessible to devices.- See also - See also - See also - universal_vector - Public Functions - 
inline device_vector()
- This constructor creates an empty - device_vector.
 - 
inline device_vector(const Alloc &alloc)
- This constructor creates an empty - device_vector.- Parameters
- alloc – The allocator to use by this device_vector. 
 
 - 
inline ~device_vector()
- The destructor erases the elements. 
 - 
inline explicit device_vector(size_type n)
- This constructor creates a - device_vectorwith the given size.- Parameters
- n – The number of elements to initially create. 
 
 - 
inline explicit device_vector(size_type n, const Alloc &alloc)
- This constructor creates a - device_vectorwith the given size.- Parameters
- n – The number of elements to initially create. 
- alloc – The allocator to use by this device_vector. 
 
 
 - 
inline explicit device_vector(size_type n, const value_type &value)
- This constructor creates a - device_vectorwith copies of an exemplar element.- Parameters
- n – The number of elements to initially create. 
- value – An element to copy. 
 
 
 - 
inline explicit device_vector(size_type n, const value_type &value, const Alloc &alloc)
- This constructor creates a - device_vectorwith copies of an exemplar element.- Parameters
- n – The number of elements to initially create. 
- value – An element to copy. 
- alloc – The allocator to use by this device_vector. 
 
 
 - 
inline device_vector(const device_vector &v)
- Copy constructor copies from an exemplar - device_vector.- Parameters
- v – The - device_vectorto copy.
 
 - 
inline device_vector(const device_vector &v, const Alloc &alloc)
- Copy constructor copies from an exemplar - device_vector.- Parameters
- v – The - device_vectorto copy.
- alloc – The allocator to use by this device_vector. 
 
 
 - 
inline device_vector(device_vector &&v)
- Move constructor moves from another - device_vector.- Parameters
- v – The device_vector to move. 
 
 - 
inline device_vector(device_vector &&v, const Alloc &alloc)
- Move constructor moves from another - device_vector.- Parameters
- v – The device_vector to move. 
- alloc – The allocator to use by this device_vector. 
 
 
 - 
inline device_vector &operator=(const device_vector &v)
- Copy assign operator copies another - device_vectorwith the same type.- Parameters
- v – The - device_vectorto copy.
 
 - 
inline device_vector &operator=(device_vector &&v)
- Move assign operator moves from another - device_vector.- Parameters
- v – The device_vector to move. 
 
 - 
template<typename OtherT, typename OtherAlloc>
 inline explicit device_vector(const device_vector<OtherT, OtherAlloc> &v)
- Copy constructor copies from an exemplar - device_vectorwith different type.- Parameters
- v – The - device_vectorto copy.
 
 - 
template<typename OtherT, typename OtherAlloc>
 inline device_vector &operator=(const device_vector<OtherT, OtherAlloc> &v)
- Assign operator copies from an exemplar - device_vectorwith different type.- Parameters
- v – The - device_vectorto copy.
 
 - 
template<typename OtherT, typename OtherAlloc>
 inline device_vector(const std::vector<OtherT, OtherAlloc> &v)
- Copy constructor copies from an exemplar - std::vector.- Parameters
- v – The - std::vectorto copy.
 
 - 
template<typename OtherT, typename OtherAlloc>
 inline device_vector &operator=(const std::vector<OtherT, OtherAlloc> &v)
- Assign operator copies from an exemplar - std::vector.- Parameters
- v – The - std::vectorto copy.
 
 - 
template<typename OtherT, typename OtherAlloc>
 inline device_vector(const detail::vector_base<OtherT, OtherAlloc> &v)
- Copy construct from a - vector_basewhose element type is convertible to- T.- Parameters
- v – The - vector_baseto copy.
 
 - 
template<typename OtherT, typename OtherAlloc>
 inline device_vector &operator=(const detail::vector_base<OtherT, OtherAlloc> &v)
- Assign a - vector_basewhose element type is convertible to- T.- Parameters
- v – The - vector_baseto copy.
 
 - 
inline device_vector(std::initializer_list<T> il)
- This constructor builds a - device_vectorfrom an intializer_list.- Parameters
- il – The intializer_list. 
 
 - 
inline device_vector(std::initializer_list<T> il, const Alloc &alloc)
- This constructor builds a - device_vectorfrom an intializer_list.- Parameters
- il – The intializer_list. 
- alloc – The allocator to use by this device_vector. 
 
 
 - 
inline device_vector &operator=(std::initializer_list<T> il)
- Assign an - intializer_listwith a matching element type- Parameters
- il – The intializer_list. 
 
 - 
template<typename InputIterator>
 inline device_vector(InputIterator first, InputIterator last)
- This constructor builds a - device_vectorfrom a range.- Parameters
- first – The beginning of the range. 
- last – The end of the range. 
 
 
 - 
template<typename InputIterator>
 inline device_vector(InputIterator first, InputIterator last, const Alloc &alloc)
- This constructor builds a - device_vectorfrom a range.- Parameters
- first – The beginning of the range. 
- last – The end of the range. 
- alloc – The allocator to use by this device_vector. 
 
 
 - Friends - 
inline friend void swap(device_vector &a, device_vector &b) noexcept(noexcept(a.swap(b)))
- Exchanges the values of two vectors. - xThe first- device_vectorof interest.- yThe second- device_vectorof interest.
 
- 
inline device_vector()