#include <array1d.h>
Public Types | |
| typedef C | value_type |
| typedef value_type * | pointer |
| typedef const value_type * | const_pointer |
| typedef value_type * | iterator |
| typedef const value_type * | const_iterator |
| typedef value_type & | reference |
| typedef const value_type & | const_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_ |
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.
| typedef const value_type* MathTL::Array1D< C >::const_iterator |
const iterator type (cf. STL containers)
| typedef const value_type* MathTL::Array1D< C >::const_pointer |
const pointer type (cf. STL containers)
| typedef const value_type& MathTL::Array1D< C >::const_reference |
const reference type (cf. STL containers)
| typedef value_type* MathTL::Array1D< C >::iterator |
iterator type (cf. STL containers)
| typedef value_type* MathTL::Array1D< C >::pointer |
pointer type (cf. STL containers)
| typedef value_type& MathTL::Array1D< C >::reference |
reference type (cf. STL containers)
| typedef size_t MathTL::Array1D< C >::size_type |
type of indexes and size of the array
| typedef C MathTL::Array1D< C >::value_type |
value type (cf. STL containers)
| MathTL::Array1D< C >::Array1D | ( | ) | [inline] |
default constructor, yields an empty array
| MathTL::Array1D< C >::Array1D | ( | const Array1D< C > & | a | ) | [inline] |
copy constructor
| 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!
| MathTL::Array1D< C >::~Array1D | ( | ) | [inline] |
release allocated memory
| Array1D< C >::const_iterator MathTL::Array1D< C >::begin | ( | ) | const [inline] |
read-only iterator access to first element (cf. STL containers)
| Array1D< C >::iterator MathTL::Array1D< C >::begin | ( | ) | [inline] |
read-write iterator access to first element (cf. STL containers)
| Array1D< C >::const_iterator MathTL::Array1D< C >::end | ( | ) | const [inline] |
read-only iterator access to the element behind the last one (cf. STL containers)
| Array1D< C >::iterator MathTL::Array1D< C >::end | ( | ) | [inline] |
read-only iterator access to the element behind the last one (cf. STL containers)
| Array1D< C > & MathTL::Array1D< C >::operator= | ( | const Array1D< C > & | a | ) |
assignment
| const C & MathTL::Array1D< C >::operator[] | ( | const size_type | i | ) | const [inline] |
read-only access to the i-th array member
| C & MathTL::Array1D< C >::operator[] | ( | const size_type | i | ) | [inline] |
read-write access to the i-th array member
| 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!
| const Array1D< C >::size_type MathTL::Array1D< C >::size | ( | ) | const [inline] |
size of the array
| void MathTL::Array1D< C >::swap | ( | Array1D< C > & | a | ) | [inline] |
swap components of two arrays
| void MathTL::Array1D< C >::swap | ( | const size_type | i, |
| const size_type | j | ||
| ) |
swap two entries of an array
C* MathTL::Array1D< C >::data_ [protected] |
internal storage is just a pointer to a C array
size_type MathTL::Array1D< C >::size_ [protected] |
size of the array
1.7.6.1