$extrastylesheet
#include <mln/util/array.hh>
Public Member Functions | |
array< T > & | append (const T &elt) |
template<typename U > | |
array< T > & | append (const array< U > &other) |
void | clear () |
void | fill (const T &value) |
std::vector< T > & | hook_std_vector_ () |
bool | is_empty () const |
ro_result | last () const |
mutable_result | last () |
std::size_t | memory_size () const |
unsigned | nelements () const |
ro_result | operator() (unsigned i) const |
mutable_result | operator() (unsigned i) |
ro_result | operator[] (unsigned i) const |
mutable_result | operator[] (unsigned i) |
void | reserve (unsigned n) |
void | resize (unsigned n) |
void | resize (unsigned n, const T &value) |
unsigned | size () const |
const std::vector< T > & | std_vector () const |
Constructors | |
array () | |
array (unsigned n) | |
array (unsigned n, const T &value) |
Public Types | |
typedef T | element |
Returned value types. | |
Related to the Function_v2v concept. | |
typedef T | result |
typedef std::vector< T > ::const_reference | ro_result |
typedef std::vector< T >::reference | mutable_result |
Iterator types | |
typedef array_fwd_iter< T > | fwd_eiter |
typedef array_bkd_iter< T > | bkd_eiter |
typedef fwd_eiter | eiter |
Related Functions | |
(Note that these are not member functions.) | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &ostr, const array< T > &a) |
template<typename T > | |
bool | operator== (const array< T > &lhs, const array< T > &rhs) |
A dynamic array class.
Elements are stored by copy. Implementation is lazy.
The parameter T
is the element type, which shall not be const-qualified.
Definition at line 80 of file util/array.hh.
mln::util::array< T >::array | ( | ) |
Constructor without argument.
mln::util::array< T >::array | ( | unsigned | n | ) |
Construct a new array and resize it to
elements.
mln::util::array< T >::array | ( | unsigned | n, |
const T & | value | ||
) |
Construct a new array, resize it to
elements and fill it with default_value
.
array<T>& mln::util::array< T >::append | ( | const T & | elt | ) |
Add the element elt
at the end of this array.
array<T>& mln::util::array< T >::append | ( | const array< U > & | other | ) |
Add the elements of other
at the end of this array.
void mln::util::array< T >::clear | ( | ) |
void mln::util::array< T >::fill | ( | const T & | value | ) |
Fill the whole array with value value
.
std::vector<T>& mln::util::array< T >::hook_std_vector_ | ( | ) |
Hook to the mutable std::vector of elements.
bool mln::util::array< T >::is_empty | ( | ) | const |
Test if the array is empty.
ro_result mln::util::array< T >::last | ( | ) | const |
Return the last element.
mutable_result mln::util::array< T >::last | ( | ) |
Return the last element.
std::size_t mln::util::array< T >::memory_size | ( | ) | const |
Return the size of this array in memory.
unsigned mln::util::array< T >::nelements | ( | ) | const |
Return the number of elements of the array.
ro_result mln::util::array< T >::operator() | ( | unsigned | i | ) | const |
Return the i-th
element of the array.
mutable_result mln::util::array< T >::operator() | ( | unsigned | i | ) |
Return the i-th
element of the array.
ro_result mln::util::array< T >::operator[] | ( | unsigned | i | ) | const |
Return the i-th
element of the array.
mutable_result mln::util::array< T >::operator[] | ( | unsigned | i | ) |
Return the i-th
element of the array.
void mln::util::array< T >::reserve | ( | unsigned | n | ) |
Reserve memory for n
elements.
void mln::util::array< T >::resize | ( | unsigned | n | ) |
Resize this array to n
elements.
void mln::util::array< T >::resize | ( | unsigned | n, |
const T & | value | ||
) |
Resize this array to n
elements with value
as value.
unsigned mln::util::array< T >::size | ( | ) | const |
Return the number of elements of the array.
Added for compatibility with fun::i2v::array.
const std::vector<T>& mln::util::array< T >::std_vector | ( | ) | const |
Return the corresponding std::vector of elements.
|
related |
Operator<<.
Operator==.
typedef array_bkd_iter<T> mln::util::array< T >::bkd_eiter |
Backward iterator associated type.
Definition at line 109 of file util/array.hh.
typedef fwd_eiter mln::util::array< T >::eiter |
Iterator associated type.
Definition at line 112 of file util/array.hh.
typedef T mln::util::array< T >::element |
Element associated type.
Definition at line 88 of file util/array.hh.
typedef array_fwd_iter<T> mln::util::array< T >::fwd_eiter |
Forward iterator associated type.
Definition at line 106 of file util/array.hh.
typedef std::vector<T>::reference mln::util::array< T >::mutable_result |
Definition at line 97 of file util/array.hh.
typedef T mln::util::array< T >::result |
Definition at line 95 of file util/array.hh.
typedef std::vector<T>::const_reference mln::util::array< T >::ro_result |
Definition at line 96 of file util/array.hh.