Class thrust::host_vector

A host_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 host_vector may vary dynamically; memory management is automatic. The memory associated with a host_vector resides in memory accessible to hosts.

Inherits From: detail::vector_base< T, std::allocator< T > >

See:

#include <thrust/host_vector.h>
template <typename T,   typename Alloc = std::allocator<T>> class thrust::host_vector { public:  _CCCL_HOST   host_vector();
  _CCCL_HOST   host_vector(const Alloc & alloc);
  _CCCL_HOST   ~host_vector();
  explicit _CCCL_HOST   host_vector(size_type n);
  explicit _CCCL_HOST   host_vector(size_type n,     const Alloc & alloc);
  explicit _CCCL_HOST   host_vector(size_type n,     const value_type & value);
  explicit _CCCL_HOST   host_vector(size_type n,     const value_type & value,     const Alloc & alloc);
  _CCCL_HOST   host_vector(const host_vector & v);
  _CCCL_HOST   host_vector(const host_vector & v,     const Alloc & alloc);
  _CCCL_HOST   host_vector(host_vector && v);
  _CCCL_HOST   host_vector(host_vector && v,     const Alloc & alloc);
  _CCCL_HOST host_vector &   operator=(const host_vector & v);
  _CCCL_HOST host_vector &   operator=(host_vector && v);
  template <typename OtherT,       typename OtherAlloc>   _CCCL_HOST   host_vector(const host_vector< OtherT, OtherAlloc > & v);
  template <typename OtherT,       typename OtherAlloc>   _CCCL_HOST host_vector &   operator=(const host_vector< OtherT, OtherAlloc > & v);
  template <typename OtherT,       typename OtherAlloc>   _CCCL_HOST   host_vector(const std::vector< OtherT, OtherAlloc > & v);
  template <typename OtherT,       typename OtherAlloc>   _CCCL_HOST host_vector &   operator=(const std::vector< OtherT, OtherAlloc > & v);
  template <typename OtherT,       typename OtherAlloc>   _CCCL_HOST   host_vector(const detail::vector_base< OtherT, OtherAlloc > & v);
  template <typename OtherT,       typename OtherAlloc>   _CCCL_HOST host_vector &   operator=(const detail::vector_base< OtherT, OtherAlloc > & v);
  host_vector(std::initializer_list< T > il);
  host_vector(std::initializer_list< T > il,     const Alloc & alloc);
  host_vector &   operator=(std::initializer_list< T > il);
  template <typename InputIterator>   _CCCL_HOST   host_vector(InputIterator first,     InputIterator last);
  template <typename InputIterator>   _CCCL_HOST   host_vector(InputIterator first,     InputIterator last,     const Alloc & alloc); };

Member Functions

Function thrust::host_vector::host_vector

_CCCL_HOST host_vector(); This constructor creates an empty host_vector.

Function thrust::host_vector::host_vector

_CCCL_HOST host_vector(const Alloc & alloc); This constructor creates an empty host_vector.

Function Parameters: alloc: The allocator to use by this host_vector.

Function thrust::host_vector::~host_vector

_CCCL_HOST ~host_vector(); The destructor erases the elements.

Function thrust::host_vector::host_vector

explicit _CCCL_HOST host_vector(size_type n); This constructor creates a host_vector with the given size.

Function Parameters: n: The number of elements to initially create.

Function thrust::host_vector::host_vector

explicit _CCCL_HOST host_vector(size_type n,   const Alloc & alloc); This constructor creates a host_vector with the given size.

Function Parameters:

  • n The number of elements to initially create.
  • alloc The allocator to use by this host_vector.

Function thrust::host_vector::host_vector

explicit _CCCL_HOST host_vector(size_type n,   const value_type & value); This constructor creates a host_vector with copies of an exemplar element.

Function Parameters:

  • n The number of elements to initially create.
  • value An element to copy.

Function thrust::host_vector::host_vector

explicit _CCCL_HOST host_vector(size_type n,   const value_type & value,   const Alloc & alloc); This constructor creates a host_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 host_vector.

Function thrust::host_vector::host_vector

_CCCL_HOST host_vector(const host_vector & v); Copy constructor copies from an exemplar host_vector.

Function Parameters: v: The host_vector to copy.

Function thrust::host_vector::host_vector

_CCCL_HOST host_vector(const host_vector & v,   const Alloc & alloc); Copy constructor copies from an exemplar host_vector.

Function Parameters:

Function thrust::host_vector::host_vector

_CCCL_HOST host_vector(host_vector && v); Move constructor moves from another host_vector.

Function Parameters: v: The host_vector to move.

Function thrust::host_vector::host_vector

_CCCL_HOST host_vector(host_vector && v,   const Alloc & alloc); Move constructor moves from another host_vector.

Function Parameters:

Function thrust::host_vector::operator=

_CCCL_HOST host_vector & operator=(const host_vector & v); Assign operator copies from an exemplar host_vector.

Function Parameters: v: The host_vector to copy.

Function thrust::host_vector::operator=

_CCCL_HOST host_vector & operator=(host_vector && v); Move assign operator moves from another host_vector.

Function Parameters: v: The host_vector to move.

Function thrust::host_vector::host_vector

template <typename OtherT,   typename OtherAlloc> _CCCL_HOST host_vector(const host_vector< OtherT, OtherAlloc > & v); Copy constructor copies from an exemplar host_vector with different type.

Function Parameters: v: The host_vector to copy.

Function thrust::host_vector::operator=

template <typename OtherT,   typename OtherAlloc> _CCCL_HOST host_vector & operator=(const host_vector< OtherT, OtherAlloc > & v); Assign operator copies from an exemplar host_vector with different type.

Function Parameters: v: The host_vector to copy.

Function thrust::host_vector::host_vector

template <typename OtherT,   typename OtherAlloc> _CCCL_HOST host_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::host_vector::operator=

template <typename OtherT,   typename OtherAlloc> _CCCL_HOST host_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::host_vector::host_vector

template <typename OtherT,   typename OtherAlloc> _CCCL_HOST host_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::host_vector::operator=

template <typename OtherT,   typename OtherAlloc> _CCCL_HOST host_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::host_vector::host_vector

host_vector(std::initializer_list< T > il); This constructor builds a host_vector from an intializer_list.

Function Parameters: il: The intializer_list.

Function thrust::host_vector::host_vector

host_vector(std::initializer_list< T > il,   const Alloc & alloc); This constructor builds a host_vector from an intializer_list.

Function Parameters:

  • il The intializer_list.
  • alloc The allocator to use by this host_vector.

Function thrust::host_vector::operator=

host_vector & operator=(std::initializer_list< T > il); Assign an intializer_list with a matching element type

Function Parameters: il: The intializer_list.

Function thrust::host_vector::host_vector

template <typename InputIterator> _CCCL_HOST host_vector(InputIterator first,   InputIterator last); This constructor builds a host_vector from a range.

Function Parameters:

  • first The beginning of the range.
  • last The end of the range.

Function thrust::host_vector::host_vector

template <typename InputIterator> _CCCL_HOST host_vector(InputIterator first,   InputIterator last,   const Alloc & alloc); This constructor builds a host_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 host_vector.