Cuda battery library
Loading...
Searching...
No Matches
battery::vector< T, Allocator > Class Template Reference

#include <vector.hpp>

Public Types

using value_type = T
 
using allocator_type = Allocator
 
using this_type = vector<value_type, allocator_type>
 

Public Member Functions

CUDA NI vector (size_t n, const allocator_type &alloc=allocator_type())
 
CUDA vector (const allocator_type &alloc=allocator_type{})
 
template<class U >
CUDA NI vector (const U *from, size_t n, const allocator_type &alloc=allocator_type{})
 
template<class U , class Allocator2 >
CUDA vector (const vector< U, Allocator2 > &from, const allocator_type &alloc=allocator_type{})
 
template<class U >
CUDA vector (const vector< U, allocator_type > &from)
 
CUDA vector (const this_type &from)
 
template<class U >
CUDA NI vector (size_t n, const U &from, const allocator_type &alloc=allocator_type{})
 
CUDA NI vector (this_type &&other)
 
CUDA NI vector (std::initializer_list< T > init, const allocator_type &alloc=allocator_type{})
 
template<class U , class Alloc2 >
 vector (const std::vector< U, Alloc2 > &other, const allocator_type &alloc=allocator_type{})
 
CUDA NI ~vector ()
 
CUDA this_typeoperator= (this_type &&other)
 
CUDA NI this_typeoperator= (const this_type &other)
 
template<class U , class Allocator2 >
CUDA NI this_typeoperator= (const vector< U, Allocator2 > &other)
 
CUDA allocator_type get_allocator () const
 
CUDA value_typeoperator[] (size_t i)
 
CUDA const value_typeoperator[] (size_t i) const
 
CUDA value_typefront ()
 
CUDA const value_typefront () const
 
CUDA value_typeback ()
 
CUDA const value_typeback () const
 
CUDA value_typedata ()
 
CUDA const value_typedata () const
 
CUDA bool empty () const
 
CUDA size_t size () const
 
CUDA void reserve (size_t new_cap)
 
CUDA size_t capacity () const
 
CUDA void shrink_to_fit ()
 
CUDA NI void clear ()
 
CUDA void push_back (const T &value)
 
CUDA void push_back (T &&value)
 
template<class... Args>
CUDA value_typeemplace_back (Args &&... args)
 
CUDA void pop_back ()
 
CUDA NI void resize (size_t count)
 
CUDA void swap (this_type &other)
 
CUDA NI void print () const
 

Friends

template<class T2 , class Allocator2 >
class vector
 

Member Typedef Documentation

◆ value_type

template<class T , class Allocator = standard_allocator>
using battery::vector< T, Allocator >::value_type = T

◆ allocator_type

template<class T , class Allocator = standard_allocator>
using battery::vector< T, Allocator >::allocator_type = Allocator

◆ this_type

template<class T , class Allocator = standard_allocator>
using battery::vector< T, Allocator >::this_type = vector<value_type, allocator_type>

Constructor & Destructor Documentation

◆ vector() [1/10]

template<class T , class Allocator = standard_allocator>
CUDA NI battery::vector< T, Allocator >::vector ( size_t n,
const allocator_type & alloc = allocator_type() )
inline

Allocate an array of size n using allocator, with n default-inserted instances of T. Allocator is scoped, meaning it will be passed to the constructor of T if T(const Allocator&) exists, otherwise T() is called.

◆ vector() [2/10]

template<class T , class Allocator = standard_allocator>
CUDA battery::vector< T, Allocator >::vector ( const allocator_type & alloc = allocator_type{})
inline

Default constructor.

◆ vector() [3/10]

template<class T , class Allocator = standard_allocator>
template<class U >
CUDA NI battery::vector< T, Allocator >::vector ( const U * from,
size_t n,
const allocator_type & alloc = allocator_type{} )
inline

Allocate an array of size n using allocator. Initialize the elements of the array with those of the array from. Allocator is scoped, meaning it will be passed to the constructor of T if T(const T&, const Allocator&) exists, otherwise T(const T&) is called.

◆ vector() [4/10]

template<class T , class Allocator = standard_allocator>
template<class U , class Allocator2 >
CUDA battery::vector< T, Allocator >::vector ( const vector< U, Allocator2 > & from,
const allocator_type & alloc = allocator_type{} )
inline

Copy constructor with an allocator, useful when the vector we copied from was declared using another allocator.

◆ vector() [5/10]

template<class T , class Allocator = standard_allocator>
template<class U >
CUDA battery::vector< T, Allocator >::vector ( const vector< U, allocator_type > & from)
inline

Copy constructor with different underlying types.

◆ vector() [6/10]

template<class T , class Allocator = standard_allocator>
CUDA battery::vector< T, Allocator >::vector ( const this_type & from)
inline

Redefine the copy constructor to be sure it calls a constructor with an allocator.

◆ vector() [7/10]

template<class T , class Allocator = standard_allocator>
template<class U >
CUDA NI battery::vector< T, Allocator >::vector ( size_t n,
const U & from,
const allocator_type & alloc = allocator_type{} )
inline

Initialize of an array of size n with each element initialized to from using allocator. Allocator is scoped, meaning it will be passed to the constructor of T if T(const T&, const Allocator&) exists, otherwise T(const T&) is called.

◆ vector() [8/10]

template<class T , class Allocator = standard_allocator>
CUDA NI battery::vector< T, Allocator >::vector ( this_type && other)
inline

◆ vector() [9/10]

template<class T , class Allocator = standard_allocator>
CUDA NI battery::vector< T, Allocator >::vector ( std::initializer_list< T > init,
const allocator_type & alloc = allocator_type{} )
inline

◆ vector() [10/10]

template<class T , class Allocator = standard_allocator>
template<class U , class Alloc2 >
battery::vector< T, Allocator >::vector ( const std::vector< U, Alloc2 > & other,
const allocator_type & alloc = allocator_type{} )
inline

◆ ~vector()

template<class T , class Allocator = standard_allocator>
CUDA NI battery::vector< T, Allocator >::~vector ( )
inline

Member Function Documentation

◆ operator=() [1/3]

template<class T , class Allocator = standard_allocator>
CUDA this_type & battery::vector< T, Allocator >::operator= ( this_type && other)
inline

◆ operator=() [2/3]

template<class T , class Allocator = standard_allocator>
CUDA NI this_type & battery::vector< T, Allocator >::operator= ( const this_type & other)
inline

◆ operator=() [3/3]

template<class T , class Allocator = standard_allocator>
template<class U , class Allocator2 >
CUDA NI this_type & battery::vector< T, Allocator >::operator= ( const vector< U, Allocator2 > & other)
inline

Beware that this operator does not free the memory of this, the capacity remains unchanged.

◆ get_allocator()

template<class T , class Allocator = standard_allocator>
CUDA allocator_type battery::vector< T, Allocator >::get_allocator ( ) const
inline

◆ operator[]() [1/2]

template<class T , class Allocator = standard_allocator>
CUDA value_type & battery::vector< T, Allocator >::operator[] ( size_t i)
inline

◆ operator[]() [2/2]

template<class T , class Allocator = standard_allocator>
CUDA const value_type & battery::vector< T, Allocator >::operator[] ( size_t i) const
inline

◆ front() [1/2]

template<class T , class Allocator = standard_allocator>
CUDA value_type & battery::vector< T, Allocator >::front ( )
inline

◆ front() [2/2]

template<class T , class Allocator = standard_allocator>
CUDA const value_type & battery::vector< T, Allocator >::front ( ) const
inline

◆ back() [1/2]

template<class T , class Allocator = standard_allocator>
CUDA value_type & battery::vector< T, Allocator >::back ( )
inline

◆ back() [2/2]

template<class T , class Allocator = standard_allocator>
CUDA const value_type & battery::vector< T, Allocator >::back ( ) const
inline

◆ data() [1/2]

template<class T , class Allocator = standard_allocator>
CUDA value_type * battery::vector< T, Allocator >::data ( )
inline

◆ data() [2/2]

template<class T , class Allocator = standard_allocator>
CUDA const value_type * battery::vector< T, Allocator >::data ( ) const
inline

◆ empty()

template<class T , class Allocator = standard_allocator>
CUDA bool battery::vector< T, Allocator >::empty ( ) const
inline

◆ size()

template<class T , class Allocator = standard_allocator>
CUDA size_t battery::vector< T, Allocator >::size ( ) const
inline

◆ reserve()

template<class T , class Allocator = standard_allocator>
CUDA void battery::vector< T, Allocator >::reserve ( size_t new_cap)
inline

◆ capacity()

template<class T , class Allocator = standard_allocator>
CUDA size_t battery::vector< T, Allocator >::capacity ( ) const
inline

◆ shrink_to_fit()

template<class T , class Allocator = standard_allocator>
CUDA void battery::vector< T, Allocator >::shrink_to_fit ( )
inline

◆ clear()

template<class T , class Allocator = standard_allocator>
CUDA NI void battery::vector< T, Allocator >::clear ( )
inline

◆ push_back() [1/2]

template<class T , class Allocator = standard_allocator>
CUDA void battery::vector< T, Allocator >::push_back ( const T & value)
inline

◆ push_back() [2/2]

template<class T , class Allocator = standard_allocator>
CUDA void battery::vector< T, Allocator >::push_back ( T && value)
inline

◆ emplace_back()

template<class T , class Allocator = standard_allocator>
template<class... Args>
CUDA value_type & battery::vector< T, Allocator >::emplace_back ( Args &&... args)
inline

◆ pop_back()

template<class T , class Allocator = standard_allocator>
CUDA void battery::vector< T, Allocator >::pop_back ( )
inline

◆ resize()

template<class T , class Allocator = standard_allocator>
CUDA NI void battery::vector< T, Allocator >::resize ( size_t count)
inline

◆ swap()

template<class T , class Allocator = standard_allocator>
CUDA void battery::vector< T, Allocator >::swap ( this_type & other)
inline

◆ print()

template<class T , class Allocator = standard_allocator>
CUDA NI void battery::vector< T, Allocator >::print ( ) const
inline

Friends And Related Symbol Documentation

◆ vector

template<class T , class Allocator = standard_allocator>
template<class T2 , class Allocator2 >
friend class vector
friend

The documentation for this class was generated from the following file: