library of assembled shared sources

http://lass.cocamware.com

lass::stde::static_vector< T, maxsize > Class Template Reference

it looks like a vector, it smells like a vector, but it only uses a fixed amout of memory More...

#include <static_vector.h>


Public Types

typedef Treference
typedef const Tconst_reference
typedef Titerator
typedef const Tconst_iterator
typedef size_t size_type
typedef ptrdiff_t difference_type
typedef T value_type
typedef Tpointer
typedef const Tconst_pointer
typedef std::reverse_iterator
< iterator
reverse_iterator
typedef std::reverse_iterator
< const_iterator
const_reverse_iterator

Public Member Functions

 static_vector ()
 static_vector (size_type n, const value_type &value=value_type())
template<typename InputIterator >
 static_vector (InputIterator first, InputIterator last)
 ~static_vector ()
void assign (size_type n=0, const value_type &value=value_type())
template<typename InputIterator >
void assign (InputIterator first, InputIterator last)
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
reverse_iterator rbegin ()
const_reverse_iterator rbegin () const
reverse_iterator rend ()
const_reverse_iterator rend () const
size_type size () const
size_type max_size () const
void resize (size_type n, const value_type &value=value_type())
size_type capacity () const
bool empty () const
void reserve (size_type n)
reference operator[] (size_type i)
const_reference operator[] (size_type i) const
reference at (size_type i)
const_reference at (size_type i) const
reference front ()
const_reference front () const
reference back ()
const_reference back () const
void push_back (const value_type &value)
void pop_back ()
void insert (iterator position, const value_type &value)
void insert (iterator position, size_type n, const value_type &value)
template<typename InputIterator >
void insert (iterator position, InputIterator first, InputIterator last)
iterator erase (iterator position)
iterator erase (iterator first, iterator last)
void clear ()
void swap (static_vector< T, maxsize > &iOther)

Private Types

enum  { max_size_ = maxsize }

Private Member Functions

pointer get_element (size_type i)
const_pointer get_element (size_type i) const
void insert (iterator position, size_type n, value_type value, meta::Wrap< meta::True > parameter_is_integral)
template<typename InputIterator >
void insert (iterator position, InputIterator first, InputIterator last, meta::Wrap< meta::False > parameter_is_iterator)
void assign (size_type n, value_type value, meta::Wrap< meta::True > parameter_is_integral)
template<typename InputIterator >
void assign (InputIterator first, InputIterator last, meta::Wrap< meta::False > parameter_is_iterator)
void move_to_back (iterator first, iterator last, size_type step)
void move_to_front (iterator first, iterator last, size_type step)
void enforce_valid_size (size_type new_size) const

Private Attributes

char data_ [max_size_ *sizeof(T)]
size_type size_

Related Functions

(Note that these are not member functions.)

template<typename T , size_t maxsize>
bool operator== (const static_vector< T, maxsize > &a, const static_vector< T, maxsize > &b)
 returns wether a and b are lexicographical idential.
template<typename T , size_t maxsize>
bool operator!= (const static_vector< T, maxsize > &a, const static_vector< T, maxsize > &b)
 returns wether a and b are not lexicographical idential.
template<typename T , size_t maxsize>
bool operator< (const static_vector< T, maxsize > &a, const static_vector< T, maxsize > &b)
 returns wether a is lexicographical less than b.
template<typename T , size_t maxsize>
bool operator> (const static_vector< T, maxsize > &a, const static_vector< T, maxsize > &b)
 returns wether b is lexicographical less than a.
template<typename T , size_t maxsize>
bool operator<= (const static_vector< T, maxsize > &a, const static_vector< T, maxsize > &b)
 returns wether a is lexicographical less or equal to b.
template<typename T , size_t maxsize>
bool operator>= (const static_vector< T, maxsize > &a, const static_vector< T, maxsize > &b)
 returns wether b is lexicographical less or equal to a.
template<typename T , size_t maxsize, typename Char , typename Traits >
std::basic_ostream< Char,
Traits > & 
operator<< (std::basic_ostream< Char, Traits > &ostream, const static_vector< T, maxsize > &container)
template<typename T , size_t maxsize, typename Char , typename Traits >
std::basic_istream< Char,
Traits > & 
operator>> (std::basic_istream< Char, Traits > &istream, static_vector< T, maxsize > &container)


Detailed Description

template<typename T, size_t maxsize>
class lass::stde::static_vector< T, maxsize >

it looks like a vector, it smells like a vector, but it only uses a fixed amout of memory

Author:
Bram de Greve [Bramz]

Definition at line 62 of file static_vector.h.


Member Typedef Documentation

template<typename T , size_t maxsize>
typedef T& lass::stde::static_vector< T, maxsize >::reference

Definition at line 66 of file static_vector.h.

template<typename T , size_t maxsize>
typedef const T& lass::stde::static_vector< T, maxsize >::const_reference

Definition at line 67 of file static_vector.h.

template<typename T , size_t maxsize>
typedef T* lass::stde::static_vector< T, maxsize >::iterator

Definition at line 68 of file static_vector.h.

template<typename T , size_t maxsize>
typedef const T* lass::stde::static_vector< T, maxsize >::const_iterator

Definition at line 69 of file static_vector.h.

template<typename T , size_t maxsize>
typedef size_t lass::stde::static_vector< T, maxsize >::size_type

Definition at line 70 of file static_vector.h.

template<typename T , size_t maxsize>
typedef ptrdiff_t lass::stde::static_vector< T, maxsize >::difference_type

Definition at line 71 of file static_vector.h.

template<typename T , size_t maxsize>
typedef T lass::stde::static_vector< T, maxsize >::value_type

Definition at line 72 of file static_vector.h.

template<typename T , size_t maxsize>
typedef T* lass::stde::static_vector< T, maxsize >::pointer

Definition at line 73 of file static_vector.h.

template<typename T , size_t maxsize>
typedef const T* lass::stde::static_vector< T, maxsize >::const_pointer

Definition at line 74 of file static_vector.h.

template<typename T , size_t maxsize>
typedef std::reverse_iterator<iterator> lass::stde::static_vector< T, maxsize >::reverse_iterator

Definition at line 75 of file static_vector.h.

template<typename T , size_t maxsize>
typedef std::reverse_iterator<const_iterator> lass::stde::static_vector< T, maxsize >::const_reverse_iterator

Definition at line 76 of file static_vector.h.


Member Enumeration Documentation

template<typename T , size_t maxsize>
anonymous enum [private]

Enumerator:
max_size_ 

Definition at line 124 of file static_vector.h.


Constructor & Destructor Documentation

template<typename T , size_t maxsize>
lass::stde::static_vector< T, maxsize >::static_vector (  )  [inline]

Definition at line 76 of file static_vector.inl.

template<typename T , size_t maxsize>
lass::stde::static_vector< T, maxsize >::static_vector ( size_type  n,
const value_type value = value_type() 
) [inline]

template<typename T , size_t maxsize>
template<typename InputIterator >
lass::stde::static_vector< T, maxsize >::static_vector ( InputIterator  first,
InputIterator  last 
) [inline]

template<typename T , size_t maxsize>
lass::stde::static_vector< T, maxsize >::~static_vector (  )  [inline]


Member Function Documentation

template<typename T , size_t maxsize>
void lass::stde::static_vector< T, maxsize >::assign ( size_type  n = 0,
const value_type value = value_type() 
) [inline]

template<typename T , size_t maxsize>
template<typename InputIterator >
void lass::stde::static_vector< T, maxsize >::assign ( InputIterator  first,
InputIterator  last 
) [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::iterator lass::stde::static_vector< T, maxsize >::begin (  )  [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::const_iterator lass::stde::static_vector< T, maxsize >::begin (  )  const [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::iterator lass::stde::static_vector< T, maxsize >::end (  )  [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::const_iterator lass::stde::static_vector< T, maxsize >::end (  )  const [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::reverse_iterator lass::stde::static_vector< T, maxsize >::rbegin (  )  [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::const_reverse_iterator lass::stde::static_vector< T, maxsize >::rbegin (  )  const [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::reverse_iterator lass::stde::static_vector< T, maxsize >::rend (  )  [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::const_reverse_iterator lass::stde::static_vector< T, maxsize >::rend (  )  const [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::size_type lass::stde::static_vector< T, maxsize >::size (  )  const [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::size_type lass::stde::static_vector< T, maxsize >::max_size (  )  const [inline]

template<typename T , size_t maxsize>
void lass::stde::static_vector< T, maxsize >::resize ( size_type  n,
const value_type value = value_type() 
) [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::size_type lass::stde::static_vector< T, maxsize >::capacity (  )  const [inline]

template<typename T , size_t maxsize>
bool lass::stde::static_vector< T, maxsize >::empty (  )  const [inline]

Definition at line 247 of file static_vector.inl.

References lass::stde::static_vector< T, maxsize >::size_.

template<typename T , size_t maxsize>
void lass::stde::static_vector< T, maxsize >::reserve ( size_type  n  )  [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::reference lass::stde::static_vector< T, maxsize >::operator[] ( size_type  i  )  [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::const_reference lass::stde::static_vector< T, maxsize >::operator[] ( size_type  i  )  const [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::reference lass::stde::static_vector< T, maxsize >::at ( size_type  i  )  [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::const_reference lass::stde::static_vector< T, maxsize >::at ( size_type  i  )  const [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::reference lass::stde::static_vector< T, maxsize >::front (  )  [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::const_reference lass::stde::static_vector< T, maxsize >::front (  )  const [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::reference lass::stde::static_vector< T, maxsize >::back (  )  [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::const_reference lass::stde::static_vector< T, maxsize >::back (  )  const [inline]

template<typename T , size_t maxsize>
void lass::stde::static_vector< T, maxsize >::push_back ( const value_type value  )  [inline]

template<typename T , size_t maxsize>
void lass::stde::static_vector< T, maxsize >::pop_back (  )  [inline]

template<typename T , size_t maxsize>
void lass::stde::static_vector< T, maxsize >::insert ( iterator  position,
const value_type value 
) [inline]

template<typename T , size_t maxsize>
void lass::stde::static_vector< T, maxsize >::insert ( iterator  position,
size_type  n,
const value_type value 
) [inline]

template<typename T , size_t maxsize>
template<typename InputIterator >
void lass::stde::static_vector< T, maxsize >::insert ( iterator  position,
InputIterator  first,
InputIterator  last 
) [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::iterator lass::stde::static_vector< T, maxsize >::erase ( iterator  position  )  [inline]

template<typename T , size_t maxsize>
static_vector< T, maxsize >::iterator lass::stde::static_vector< T, maxsize >::erase ( iterator  first,
iterator  last 
) [inline]

template<typename T , size_t maxsize>
void lass::stde::static_vector< T, maxsize >::clear (  )  [inline]

template<typename T , size_t maxsize>
void lass::stde::static_vector< T, maxsize >::swap ( static_vector< T, maxsize > &  iOther  )  [inline]

template<typename T , size_t maxsize>
pointer lass::stde::static_vector< T, maxsize >::get_element ( size_type  i  )  [inline, private]

template<typename T , size_t maxsize>
const_pointer lass::stde::static_vector< T, maxsize >::get_element ( size_type  i  )  const [inline, private]

Definition at line 127 of file static_vector.h.

References lass::stde::static_vector< T, maxsize >::data_.

template<typename T , size_t maxsize>
void lass::stde::static_vector< T, maxsize >::insert ( iterator  position,
size_type  n,
value_type  value,
meta::Wrap< meta::True parameter_is_integral 
) [inline, private]

template<typename T , size_t maxsize>
template<typename InputIterator >
void lass::stde::static_vector< T, maxsize >::insert ( iterator  position,
InputIterator  first,
InputIterator  last,
meta::Wrap< meta::False parameter_is_iterator 
) [inline, private]

template<typename T , size_t maxsize>
void lass::stde::static_vector< T, maxsize >::assign ( size_type  n,
value_type  value,
meta::Wrap< meta::True parameter_is_integral 
) [inline, private]

template<typename T , size_t maxsize>
template<typename InputIterator >
void lass::stde::static_vector< T, maxsize >::assign ( InputIterator  first,
InputIterator  last,
meta::Wrap< meta::False parameter_is_iterator 
) [inline, private]

template<typename T , size_t maxsize>
void lass::stde::static_vector< T, maxsize >::move_to_back ( iterator  first,
iterator  last,
size_type  step 
) [inline, private]

Definition at line 440 of file static_vector.inl.

Referenced by lass::stde::static_vector< T, maxsize >::insert().

template<typename T , size_t maxsize>
void lass::stde::static_vector< T, maxsize >::move_to_front ( iterator  first,
iterator  last,
size_type  step 
) [inline, private]

Definition at line 453 of file static_vector.inl.

Referenced by lass::stde::static_vector< T, maxsize >::erase().

template<typename T , size_t maxsize>
void lass::stde::static_vector< T, maxsize >::enforce_valid_size ( size_type  new_size  )  const [inline, private]


Friends And Related Function Documentation

template<typename T , size_t maxsize>
bool operator== ( const static_vector< T, maxsize > &  a,
const static_vector< T, maxsize > &  b 
) [related]

returns wether a and b are lexicographical idential.

Parameters:
a first static_vector
b second static_vector
returns true if a.size() == b.size() and each element of is considered equal to its corresponding element in b by using operator==

O(N) with N = a.size() == b.size() ? a.size() : 1

Definition at line 545 of file static_vector.inl.

References lass::stde::static_vector< T, maxsize >::begin(), lass::stde::static_vector< T, maxsize >::end(), and lass::stde::static_vector< T, maxsize >::size().

template<typename T , size_t maxsize>
bool operator!= ( const static_vector< T, maxsize > &  a,
const static_vector< T, maxsize > &  b 
) [related]

returns wether a and b are not lexicographical idential.

Parameters:
a first static_vector
b second static_vector
Is equivalent to !(a == b)

O(N) with N = a.size() == b.size() ? a.size() : 1

Definition at line 576 of file static_vector.inl.

template<typename T , size_t maxsize>
bool operator< ( const static_vector< T, maxsize > &  a,
const static_vector< T, maxsize > &  b 
) [related]

returns wether a is lexicographical less than b.

Parameters:
a first static_vector
b second static_vector
returns true if for the first difference between a and b the element of a is less than the corresponding one of b. In case no different elements between and b can be found, it returns true if a.size() < b.size()

O(N) with N = std::min(a.size(), b.size())

Definition at line 596 of file static_vector.inl.

template<typename T , size_t maxsize>
bool operator> ( const static_vector< T, maxsize > &  a,
const static_vector< T, maxsize > &  b 
) [related]

returns wether b is lexicographical less than a.

Parameters:
a first static_vector
b second static_vector
Is equivalent to (b < a)

O(N) with N = std::min(a.size(), b.size())

Definition at line 628 of file static_vector.inl.

template<typename T , size_t maxsize>
bool operator<= ( const static_vector< T, maxsize > &  a,
const static_vector< T, maxsize > &  b 
) [related]

returns wether a is lexicographical less or equal to b.

Parameters:
a first static_vector
b second static_vector
Is equivalent to !(b < a)

O(N) with N = std::min(a.size(), b.size())

Definition at line 646 of file static_vector.inl.

template<typename T , size_t maxsize>
bool operator>= ( const static_vector< T, maxsize > &  a,
const static_vector< T, maxsize > &  b 
) [related]

returns wether b is lexicographical less or equal to a.

Parameters:
a first static_vector
b second static_vector
Is equivalent to !(a < b)

O(N) with N = std::min(a.size(), b.size())

Definition at line 664 of file static_vector.inl.

template<typename T , size_t maxsize, typename Char , typename Traits >
std::basic_ostream< Char, Traits > & operator<< ( std::basic_ostream< Char, Traits > &  ostream,
const static_vector< T, maxsize > &  container 
) [related]

writes static_vector to output stream.

Parameters:
ostream should be a good stream.
container static_vector to be written as [foo, bar, spam, ham]
complexity: O(N) with N = container.size()

Definition at line 681 of file static_vector.inl.

References lass::stde::impl::print_sequence().

template<typename T , size_t maxsize, typename Char , typename Traits >
std::basic_istream< Char, Traits > & operator>> ( std::basic_istream< Char, Traits > &  istream,
static_vector< T, maxsize > &  container 
) [related]

reads list from stream.

Parameters:
istream should be a good stream.
container static_vector to be read as [foo, bar, spam, ham]
complexity: O(N) with N = number of elements to be read.

Precondition:
maxsize should be large enough to read all elements

Definition at line 702 of file static_vector.inl.


Field Documentation

template<typename T , size_t maxsize>
char lass::stde::static_vector< T, maxsize >::data_[max_size_ *sizeof(T)] [private]

template<typename T , size_t maxsize>
size_type lass::stde::static_vector< T, maxsize >::size_ [private]


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

Generated on Mon Nov 10 14:22:16 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo