MathTL
 All Classes Functions Variables Typedefs Enumerations
Public Types | Public Member Functions | Protected Attributes
MathTL::Array1D< C > Class Template Reference

#include <array1d.h>

List of all members.

Public Types

typedef C value_type
typedef value_typepointer
typedef const value_typeconst_pointer
typedef value_typeiterator
typedef const value_typeconst_iterator
typedef value_typereference
typedef const value_typeconst_reference
typedef size_t size_type

Public Member Functions

 Array1D ()
 Array1D (const Array1D< C > &a)
 Array1D (const size_type s)
 ~Array1D ()
const size_type size () const
void resize (const size_type s)
Array1D< C > & operator= (const Array1D< C > &a)
const C & operator[] (const size_type i) const
C & operator[] (const size_type i)
const_iterator begin () const
iterator begin ()
const_iterator end () const
iterator end ()
void swap (Array1D< C > &a)
void swap (const size_type i, const size_type j)

Protected Attributes

C * data_
size_type size_

Detailed Description

template<class C>
class MathTL::Array1D< C >

This class models one-dimensional arrays of objects from an arbitrary class C and is merely a wrapper class around a conventional C-style array. Array1D<C> has the same interface as std::vector<C>, but it is much faster in practice due to the internal storage format. Even compared with a std::valarray<C>, one gains a bit of performance.


Member Typedef Documentation

template<class C>
typedef const value_type* MathTL::Array1D< C >::const_iterator

const iterator type (cf. STL containers)

template<class C>
typedef const value_type* MathTL::Array1D< C >::const_pointer

const pointer type (cf. STL containers)

template<class C>
typedef const value_type& MathTL::Array1D< C >::const_reference

const reference type (cf. STL containers)

template<class C>
typedef value_type* MathTL::Array1D< C >::iterator

iterator type (cf. STL containers)

template<class C>
typedef value_type* MathTL::Array1D< C >::pointer

pointer type (cf. STL containers)

template<class C>
typedef value_type& MathTL::Array1D< C >::reference

reference type (cf. STL containers)

template<class C>
typedef size_t MathTL::Array1D< C >::size_type

type of indexes and size of the array

template<class C>
typedef C MathTL::Array1D< C >::value_type

value type (cf. STL containers)


Constructor & Destructor Documentation

template<class C >
MathTL::Array1D< C >::Array1D ( ) [inline]

default constructor, yields an empty array

template<class C>
MathTL::Array1D< C >::Array1D ( const Array1D< C > &  a) [inline]

copy constructor

template<class C>
MathTL::Array1D< C >::Array1D ( const size_type  s) [inline, explicit]

Construct an array of positive size, please note that the builtin types (int, double, ...) may _not_ automatically be set to _zero_, this depends on the compiler!

template<class C >
MathTL::Array1D< C >::~Array1D ( ) [inline]

release allocated memory


Member Function Documentation

template<class C >
Array1D< C >::const_iterator MathTL::Array1D< C >::begin ( ) const [inline]

read-only iterator access to first element (cf. STL containers)

template<class C >
Array1D< C >::iterator MathTL::Array1D< C >::begin ( ) [inline]

read-write iterator access to first element (cf. STL containers)

template<class C >
Array1D< C >::const_iterator MathTL::Array1D< C >::end ( ) const [inline]

read-only iterator access to the element behind the last one (cf. STL containers)

template<class C >
Array1D< C >::iterator MathTL::Array1D< C >::end ( ) [inline]

read-only iterator access to the element behind the last one (cf. STL containers)

template<class C>
Array1D< C > & MathTL::Array1D< C >::operator= ( const Array1D< C > &  a)

assignment

template<class C >
const C & MathTL::Array1D< C >::operator[] ( const size_type  i) const [inline]

read-only access to the i-th array member

template<class C >
C & MathTL::Array1D< C >::operator[] ( const size_type  i) [inline]

read-write access to the i-th array member

template<class C >
void MathTL::Array1D< C >::resize ( const size_type  s)

resize the array

Warning: the initialization of the entries depends on the compiler (and even on the compiler options). It may very well be something like NAN!

template<class C >
const Array1D< C >::size_type MathTL::Array1D< C >::size ( ) const [inline]

size of the array

template<class C>
void MathTL::Array1D< C >::swap ( Array1D< C > &  a) [inline]

swap components of two arrays

template<class C>
void MathTL::Array1D< C >::swap ( const size_type  i,
const size_type  j 
)

swap two entries of an array


Member Data Documentation

template<class C>
C* MathTL::Array1D< C >::data_ [protected]

internal storage is just a pointer to a C array

template<class C>
size_type MathTL::Array1D< C >::size_ [protected]

size of the array


The documentation for this class was generated from the following files:
 All Classes Functions Variables Typedefs Enumerations