ug4
ug::VariableArray1< T > Class Template Reference

#include <variable_array.h>

+ Inheritance diagram for ug::VariableArray1< T >:

Public Types

typedef size_t size_type
 
typedef variable_type storage_type
 
typedef T value_type
 

Public Member Functions

T & at (size_type i)
 
const T & at (size_type i) const
 
size_type capacity () const
 
T & operator[] (size_type i)
 
const T & operator[] (size_type i) const
 
bool reserve (size_type n) const
 
bool resize (size_type n, bool bCopyValues=true)
 
size_type size () const
 
 VariableArray1 ()
 
 VariableArray1 (const VariableArray1< T > &other)
 
 VariableArray1 (size_type n_)
 
 ~VariableArray1 ()
 

Protected Attributes

size_type n
 
T * values
 

Friends

template<typename _T >
std::ostream & operator<< (std::ostream &out, const VariableArray1< _T > &arr)
 

Detailed Description

template<typename T>
class ug::VariableArray1< T >

VariableArray1 is a one-dimensional array which supports most of the interface of std::vector (some functions and iterators have to be added). You can use VariableArray1 in DenseVector to get a variable size mathematical Vector. Use storage_traits<type>::is_static to distinguish between fixed and variable vectors. There is a small difference between std::vector and VariableArray1: VariableArray1::capacity == VariableArray1::size, that means there is no capacity buffering. This might be helpful if you have millions of instances of VariableArray1, since you will have a) exactly as many memory allocated as you need b) sizeof(VariableArray1) < sizeof(std::vector) ( 8 vs. 12 on 32-bit systems).

Parameters
Ttype of object in Array (i.e. double)

Member Typedef Documentation

◆ size_type

template<typename T >
typedef size_t ug::VariableArray1< T >::size_type

◆ storage_type

template<typename T >
typedef variable_type ug::VariableArray1< T >::storage_type

◆ value_type

template<typename T >
typedef T ug::VariableArray1< T >::value_type

Constructor & Destructor Documentation

◆ VariableArray1() [1/3]

template<typename T >
ug::VariableArray1< T >::VariableArray1

◆ VariableArray1() [2/3]

template<typename T >
ug::VariableArray1< T >::VariableArray1 ( size_type  n_)

References resize().

◆ VariableArray1() [3/3]

template<typename T >
ug::VariableArray1< T >::VariableArray1 ( const VariableArray1< T > &  other)

◆ ~VariableArray1()

template<typename T >
ug::VariableArray1< T >::~VariableArray1

Member Function Documentation

◆ at() [1/2]

template<typename T >
T& ug::VariableArray1< T >::at ( size_type  i)
inline

◆ at() [2/2]

template<typename T >
const T& ug::VariableArray1< T >::at ( size_type  i) const
inline

◆ capacity()

template<typename T >
size_t ug::VariableArray1< T >::capacity
inline

◆ operator[]() [1/2]

template<typename T >
T & ug::VariableArray1< T >::operator[] ( size_type  i)
inline

◆ operator[]() [2/2]

template<typename T >
const T & ug::VariableArray1< T >::operator[] ( size_type  i) const
inline

◆ reserve()

template<typename T >
bool ug::VariableArray1< T >::reserve ( size_type  n) const
inline

◆ resize()

◆ size()

template<typename T >
size_t ug::VariableArray1< T >::size
inline

Referenced by ug::operator<<().

Friends And Related Function Documentation

◆ operator<<

template<typename T >
template<typename _T >
std::ostream& operator<< ( std::ostream &  out,
const VariableArray1< _T > &  arr 
)
friend

Member Data Documentation

◆ n

template<typename T >
size_type ug::VariableArray1< T >::n
protected

◆ values

template<typename T >
T* ug::VariableArray1< T >::values
protected

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