SOFA API  6a688117
Open source framework for multi-physics simuation
sofa::helper::vector< T, CPUMemoryManager< T > > Class Template Reference

#include <vector.h>

Inheritance diagram for sofa::helper::vector< T, CPUMemoryManager< T > >:

Detailed Description

template<class T>
class sofa::helper::vector< T, CPUMemoryManager< T > >

Regular vector Using CPUMemoryManager, it has the same behavior as std::helper with extra conveniences:

  • string serialization (making it usable in Data)
  • operator[] is checking if the index is within the bounds in debug

Classes

struct  rebind
 

Public Member Functions

 vector ()
 Basic constructor. More...
 
 vector (size_type n, const T &value)
 Constructor. More...
 
 vector (int n, const T &value)
 Constructor. More...
 
 vector (long n, const T &value)
 Constructor. More...
 
 vector (size_type n)
 Constructor. More...
 
 vector (const std::vector< T, Alloc > &x)
 Constructor. More...
 
 vector (const std::initializer_list< T > &t)
 Brace initalizer constructor. More...
 
 vector (std::vector< T, Alloc > &&v)
 Move constructor. More...
 
vector< T, Alloc > & operator= (const std::vector< T, Alloc > &x)
 Copy operator. More...
 
vector< T, Alloc > & operator= (std::vector< T, Alloc > &&v)
 Move assignment operator. More...
 
 vector (typename vector< T >::const_iterator first, typename vector< T >::const_iterator last)
 Constructor. More...
 
reference operator[] (size_type n)
 Read/write random access. More...
 
const_reference operator[] (size_type n) const
 Read-only random access. More...
 
std::ostream & write (std::ostream &os) const
 
std::istream & read (std::istream &in)
 
void fill (const T &value)
 Sets every element to 'value'. More...
 
void fastResize (size_type n)
 

Friends

std::ostream & operator<< (std::ostream &os, const vector< T > &vec)
 Output stream. More...
 
std::istream & operator>> (std::istream &in, vector< T > &vec)
 Input stream. More...
 

Constructor details

template<class T >
sofa::helper::vector< T, CPUMemoryManager< T > >::vector ( )
inline

Basic constructor.

template<class T >
sofa::helper::vector< T, CPUMemoryManager< T > >::vector ( size_type  n,
const T &  value 
)
inline

Constructor.

template<class T >
sofa::helper::vector< T, CPUMemoryManager< T > >::vector ( int  n,
const T &  value 
)
inline

Constructor.

template<class T >
sofa::helper::vector< T, CPUMemoryManager< T > >::vector ( long  n,
const T &  value 
)
inline

Constructor.

template<class T >
sofa::helper::vector< T, CPUMemoryManager< T > >::vector ( size_type  n)
inlineexplicit

Constructor.

template<class T >
sofa::helper::vector< T, CPUMemoryManager< T > >::vector ( const std::vector< T, Alloc > &  x)
inline

Constructor.

template<class T >
sofa::helper::vector< T, CPUMemoryManager< T > >::vector ( const std::initializer_list< T > &  t)
inline

Brace initalizer constructor.

template<class T >
sofa::helper::vector< T, CPUMemoryManager< T > >::vector ( std::vector< T, Alloc > &&  v)
inline

Move constructor.

template<class T >
sofa::helper::vector< T, CPUMemoryManager< T > >::vector ( typename vector< T >::const_iterator  first,
typename vector< T >::const_iterator  last 
)
inline

Constructor.

Function details

template<class T >
void sofa::helper::vector< T, CPUMemoryManager< T > >::fastResize ( size_type  n)
inline

this function is usefull for vector_device because it resize the vector without device operation (if device is not valid). Therefore the function is used in asynchronous code to safly resize a vector which is either cuda of helper::vector

template<class T >
void sofa::helper::vector< T, CPUMemoryManager< T > >::fill ( const T &  value)
inline

Sets every element to 'value'.

template<class T >
vector<T, Alloc>& sofa::helper::vector< T, CPUMemoryManager< T > >::operator= ( const std::vector< T, Alloc > &  x)
inline

Copy operator.

template<class T >
vector<T, Alloc>& sofa::helper::vector< T, CPUMemoryManager< T > >::operator= ( std::vector< T, Alloc > &&  v)
inline

Move assignment operator.

template<class T >
reference sofa::helper::vector< T, CPUMemoryManager< T > >::operator[] ( size_type  n)
inline

Read/write random access.

template<class T >
const_reference sofa::helper::vector< T, CPUMemoryManager< T > >::operator[] ( size_type  n) const
inline

Read-only random access.

template<class T >
std::istream& sofa::helper::vector< T, CPUMemoryManager< T > >::read ( std::istream &  in)
inline
template<class T >
std::ostream& sofa::helper::vector< T, CPUMemoryManager< T > >::write ( std::ostream &  os) const
inline

Related details

template<class T >
std::ostream& operator<< ( std::ostream &  os,
const vector< T > &  vec 
)
friend

Output stream.

template<class T >
std::istream& operator>> ( std::istream &  in,
vector< T > &  vec 
)
friend

Input stream.