Public Member Functions
Vector< T > Class Template Reference

A wrapper around the c-array to provide an STL like interface for iterators. More...

#include <mia/core/vector.hh>

Public Member Functions

iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
void make_unique ()
 
Vector< T > & operator= (const Vector< T > &other)
 assignment operator More...
 
reference operator[] (size_t i)
 
const_reference operator[] (size_t i) const
 
size_type size () const
 
 Vector (size_t n, bool clean=true)
 */ More...
 
 Vector (const Vector< T > &other)
 
 Vector (size_t n, T *init)
 
 Vector (size_t n, const T *init)
 

Detailed Description

template<typename T>
class Vector< T >

A wrapper around the c-array to provide an STL like interface for iterators.

c-array envelope that supports some facilities of STL like vectors and that allows holding pre-allocated data. Handling of the optinal deleting of the array is done by a destructor template passed to the std::shared_ptr constructor

Template Parameters
thedata type of the C-array

Definition at line 74 of file core/vector.hh.

Constructor & Destructor Documentation

template<typename T>
Vector< T >::Vector ( size_t  n,
bool  clean = true 
)
inline

*/

Create a vector, the data is owned by this vector and will be deleted if the reference count reaches zero

Parameters
n
cleaninitialize vector to 0

Definition at line 92 of file core/vector.hh.

template<typename T>
Vector< T >::Vector ( const Vector< T > &  other)
inline

copy constructor, this is a shallow copy, i.e. the data is shared between the original and the copied vector

Parameters
other

Definition at line 105 of file core/vector.hh.

template<typename T>
Vector< T >::Vector ( size_t  n,
T *  init 
)
inline

Constructor that creates the STL-like vector as an envelop around a C-array. The data will not be freed at destruction time.

Parameters
nsize of input array
initallocated input data

Definition at line 127 of file core/vector.hh.

template<typename T>
Vector< T >::Vector ( size_t  n,
const T *  init 
)
inline

Constructor that creates the STL-like vector as an envelop around a C-array. The data will not be freed at destruction time.

Parameters
nsize of input array
initallocated input data

Definition at line 140 of file core/vector.hh.

Member Function Documentation

template<typename T>
iterator Vector< T >::begin ( )
inline

STL compatible iterator, begin of range

Definition at line 170 of file core/vector.hh.

References DEBUG_ASSERT_RELEASE_THROW.

template<typename T>
const_iterator Vector< T >::begin ( ) const
inline

STL compatible const_iterator, begin of range

Definition at line 193 of file core/vector.hh.

template<typename T>
iterator Vector< T >::end ( )
inline

STL compatible iterator, end of range

Definition at line 181 of file core/vector.hh.

References DEBUG_ASSERT_RELEASE_THROW.

template<typename T>
const_iterator Vector< T >::end ( ) const
inline

STL compatible const_iterator, end of range

Definition at line 200 of file core/vector.hh.

template<typename T>
void Vector< T >::make_unique ( )
inline

If the wrapped data is referenced more than once or is read-only, make a copy inside this object that is refereneces only once and writable.

Definition at line 217 of file core/vector.hh.

template<typename T>
Vector<T>& Vector< T >::operator= ( const Vector< T > &  other)
inline

assignment operator

Definition at line 113 of file core/vector.hh.

template<typename T>
reference Vector< T >::operator[] ( size_t  i)
inline

Standard array access operator, read-write version

Definition at line 150 of file core/vector.hh.

References DEBUG_ASSERT_RELEASE_THROW.

template<typename T>
const_reference Vector< T >::operator[] ( size_t  i) const
inline

Standard array access operator, read-only version

Definition at line 162 of file core/vector.hh.

template<typename T>
size_type Vector< T >::size ( ) const
inline
Returns
number of elements in the array

Definition at line 207 of file core/vector.hh.


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