A static array of arrays. More...
#include <StaticArrayOfArrays.h>
Public Types | |
typedef Types::value_type | value_type |
The element type. | |
typedef Types::parameter_type | parameter_type |
The parameter type. | |
typedef Types::unqualified_value_type | unqualified_value_type |
The unqualified value type. | |
typedef Types::pointer | pointer |
A pointer to an array element. | |
typedef Types::const_pointer | const_pointer |
A pointer to a constant array element. | |
typedef Types::iterator | iterator |
An iterator in the array. | |
typedef Types::const_iterator | const_iterator |
A iterator on constant elements in the array. | |
typedef Types::reference | reference |
A reference to an array element. | |
typedef Types::const_reference | const_reference |
A reference to a constant array element. | |
typedef Types::size_type | size_type |
The size type is a signed integer. | |
typedef Types::difference_type | difference_type |
Pointer difference type. | |
Public Member Functions | |
Constructors etc. | |
StaticArrayOfArrays () | |
Default constructor. Empty data structure. | |
template<typename IntForwardIter , typename ValueForwardIter > | |
StaticArrayOfArrays (IntForwardIter sizesBeginning, IntForwardIter sizesEnd, ValueForwardIter valuesBeginning, ValueForwardIter valuesEnd) | |
Construct from the array sizes and the values. | |
template<typename IntForwardIter > | |
void | rebuild (const size_type numberOfElements, IntForwardIter sizesBeginning, IntForwardIter sizesEnd) |
Rebuild from the array sizes. | |
template<typename IntForwardIter , typename ValueForwardIter > | |
void | rebuild (IntForwardIter sizesBeginning, IntForwardIter sizesEnd, ValueForwardIter valuesBeginning, ValueForwardIter valuesEnd) |
Rebuild from the array sizes and the values. | |
StaticArrayOfArrays (const StaticArrayOfArrays &other) | |
Copy constructor. | |
~StaticArrayOfArrays () | |
Destructor. | |
Assignment operators. | |
StaticArrayOfArrays & | operator= (const StaticArrayOfArrays &other) |
Assignment operator. | |
Accessors for the whole set of elements. | |
size_type | getNumberOfArrays () const |
Return the number of arrays. | |
size_type | size () const |
Return the total number of elements. | |
size_type | getMemoryUsage () const |
Return the memory size. | |
const_iterator | begin () const |
const_iterator | end () const |
Return a const iterator to one past the last value. | |
Accessors for individual arrays. | |
size_type | size (const int n) const |
Return the number of elements in the n_th array. | |
bool | empty (const int n) const |
Return true if the n_th array is empty. | |
const_iterator | begin (const int n) const |
Return a const iterator to the first value in the n_th array. | |
const_iterator | end (const int n) const |
Return a const iterator to one past the last value in the n_th array. | |
const_iterator | operator[] (const int n) const |
Return a const iterator to the first element of the n_th array. | |
const_iterator | operator() (const int n) const |
Return a const iterator to the first element of the n_th array. | |
parameter_type | operator() (const int n, const int m) const |
Return the m_th element of the n_th array. | |
Manipulators for the whole set of elements. | |
iterator | begin () |
iterator | end () |
Return an iterator to one past the last value. | |
void | swap (StaticArrayOfArrays &other) |
Swaps data with another StaticArrayOfArrays. | |
void | clear () |
Clear the array of arrays. | |
Manipulators for individual arrays. | |
iterator | begin (const int n) |
Return an iterator to the first value in the n_th array. | |
iterator | end (const int n) |
Return an iterator to one past the last value in the n_th array. | |
iterator | operator[] (const int n) |
Return an iterator to the first element of the n_th array. | |
iterator | operator() (const int n) |
Return an iterator to the first element of the n_th array. | |
reference | operator() (const int n, const int m) |
Return the m_th element of the n_th array. | |
Assignment operators with scalar operand. | |
StaticArrayOfArrays & | operator= (parameter_type x) |
Set each element to x . | |
Equality. | |
bool | operator== (const StaticArrayOfArrays< T > &x) const |
Return true if the arrays are equal. | |
bool | operator!= (const StaticArrayOfArrays< T > &x) const |
Return true if the arrays are not equal. | |
File I/O. | |
void | put (std::ostream &out) const |
Write to a file stream in ascii format. | |
void | get (std::istream &in) |
Read from a file stream in ascii format. | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, const StaticArrayOfArrays< T > &x) |
Write a StaticArrayOfArrays in ascii format. | |
template<typename T > | |
std::istream & | operator>> (std::istream &in, StaticArrayOfArrays< T > &x) |
Read a StaticArrayOfArrays in ascii format. |
A static array of arrays.
T | is the value type. By default it is double. |
typedef Types::parameter_type StaticArrayOfArrays< T >::parameter_type |
The parameter type.
This is used for passing the value type as an argument.
Reimplemented from ArrayContainer< T >.
typedef Types::size_type StaticArrayOfArrays< T >::size_type |
The size type is a signed integer.
Having std::size_t
(which is an unsigned integer) as the size type causes minor problems. Consult "Large Scale C++ Software Design" by John Lakos for a discussion of using unsigned integers in a class interface.
Reimplemented from ArrayContainer< T >.
typedef Types::unqualified_value_type StaticArrayOfArrays< T >::unqualified_value_type |
The unqualified value type.
The value type with top level const
and volatile
qualifiers removed.
Reimplemented from ArrayContainer< T >.
iterator StaticArrayOfArrays< T >::begin | ( | ) | [inline] |
Return an iterator to the first value.
Reimplemented from ArrayContainer< T >.
References ArrayContainer< T >::begin().
const_iterator StaticArrayOfArrays< T >::begin | ( | ) | const [inline] |
Return a const iterator to the first value.
Reimplemented from ArrayContainer< T >.
References ArrayContainer< T >::begin().
Referenced by StaticArrayOfArrays< T >::clear(), StaticArrayOfArrays< T >::operator()(), StaticArrayOfArrays< T >::operator=(), StaticArrayOfArrays< T >::operator[](), StaticArrayOfArrays< T >::rebuild(), and StaticArrayOfArrays< T >::StaticArrayOfArrays().
std::ostream & operator<< | ( | std::ostream & | out, | |
const StaticArrayOfArrays< T > & | x | |||
) | [related] |
Write a StaticArrayOfArrays in ascii format.
Below is the file format.
number_of_arrays number_of_elements array_0_size array_0_value_0 array_0_value_1 ... array_1_size array_1_value_0 array_1_value_1 ... ...
std::istream & operator>> | ( | std::istream & | in, | |
StaticArrayOfArrays< T > & | x | |||
) | [related] |
Read a StaticArrayOfArrays in ascii format.
Below is the file format.
number_of_arrays number_of_elements array_0_size array_0_value_0 array_0_value_1 ... array_1_size array_1_value_0 array_1_value_1 ... ...
References StaticArrayOfArrays< T >::get().