#include <array.hh>
Public Types | |
typedef T | element |
Element associated type. | |
typedef array_bkd_iter< T > | bkd_eiter |
Backward iterator associated type. | |
typedef fwd_eiter | eiter |
Iterator associated type. | |
typedef array_fwd_iter< T > | fwd_eiter |
Iterator types | |
typedef T | result |
Returned value types. | |
Public Member Functions | |
template<typename U> | |
array< T > & | append (const array< U > &other) |
Add the elements of other at the end of this array. | |
array< T > & | append (const T &elt) |
Add the element elt at the end of this array. | |
void | clear () |
Empty the array. | |
void | fill (const T &value) |
Fill the whole array with value value . | |
bool | is_empty () const |
Test if the array is empty. | |
std::size_t | memory_size () const |
Return the size of this array in memory. | |
unsigned | nelements () const |
Return the number of elements of the array. | |
mutable_result | operator() (unsigned i) |
Return the i-th element of the array. | |
ro_result | operator() (unsigned i) const |
Return the i-th element of the array. | |
mutable_result | operator[] (unsigned i) |
Return the i-th element of the array. | |
ro_result | operator[] (unsigned i) const |
Return the i-th element of the array. | |
void | reserve (unsigned n) |
Reserve memory for n elements. | |
void | resize (unsigned n, const T &value) |
Resize this array to n elements with value as value. | |
void | resize (unsigned n) |
Resize this array to n elements. | |
unsigned | size () const |
Return the number of elements of the array. | |
const std::vector< T > & | std_vector () const |
Return the corresponding std::vector of elements. | |
array (unsigned n, const T &value) | |
Construct a new array, resize it to elements and fill it with default_value . | |
array (unsigned n) | |
Construct a new array and resize it to elements. | |
array () | |
Constructors |
Elements are stored by copy. Implementation is lazy.
The parameter T
is the element type, which shall not be const-qualified.
typedef array_bkd_iter<T> mln::util::array< T >::bkd_eiter |
Backward iterator associated type.
typedef fwd_eiter mln::util::array< T >::eiter |
Iterator associated type.
typedef T mln::util::array< T >::element |
Element associated type.
typedef array_fwd_iter<T> mln::util::array< T >::fwd_eiter |
typedef T mln::util::array< T >::result |
Returned value types.
Related to the Function_v2v concept.
mln::util::array< T >::array | ( | ) | [inline] |
Constructors
Constructor without arguments.
mln::util::array< T >::array | ( | unsigned | n | ) | [inline] |
Construct a new array and resize it to
elements.
mln::util::array< T >::array | ( | unsigned | n, | |
const T & | value | |||
) | [inline] |
Construct a new array, resize it to
elements and fill it with default_value
.
array< T > & mln::util::array< T >::append | ( | const array< U > & | other | ) | [inline] |
Add the elements of other
at the end of this array.
References mln::util::array< T >::is_empty(), and mln::util::array< T >::std_vector().
array< T > & mln::util::array< T >::append | ( | const T & | elt | ) | [inline] |
Add the element elt
at the end of this array.
Referenced by mln::io::plot::load(), and mln::data::impl::generic::sort_offsets_increasing().
void mln::util::array< T >::clear | ( | ) | [inline] |
Empty the array.
All elements contained in the array are destroyed.
References mln::util::array< T >::is_empty().
Referenced by mln::io::plot::load().
void mln::util::array< T >::fill | ( | const T & | value | ) | [inline] |
bool mln::util::array< T >::is_empty | ( | ) | const [inline] |
Test if the array is empty.
References mln::util::array< T >::nelements().
Referenced by mln::util::array< T >::append(), mln::util::array< T >::clear(), mln::make::image3d(), and mln::io::pnms::load().
std::size_t mln::util::array< T >::memory_size | ( | ) | const [inline] |
unsigned mln::util::array< T >::nelements | ( | ) | const [inline] |
Return the number of elements of the array.
Referenced by mln::labeling::fill_holes(), mln::make::image3d(), mln::util::array< T >::is_empty(), mln::io::pnms::load(), mln::util::array< T >::memory_size(), mln::util::operator<<(), mln::util::array< T >::operator[](), and mln::util::array< T >::size().
array< T >::mutable_result mln::util::array< T >::operator() | ( | unsigned | i | ) | [inline] |
array< T >::ro_result mln::util::array< T >::operator() | ( | unsigned | i | ) | const [inline] |
array< T >::mutable_result mln::util::array< T >::operator[] | ( | unsigned | i | ) | [inline] |
Return the i-th
element of the array.
References mln::util::array< T >::nelements().
array< T >::ro_result mln::util::array< T >::operator[] | ( | unsigned | i | ) | const [inline] |
Return the i-th
element of the array.
References mln::util::array< T >::nelements().
void mln::util::array< T >::reserve | ( | unsigned | n | ) | [inline] |
void mln::util::array< T >::resize | ( | unsigned | n, | |
const T & | value | |||
) | [inline] |
void mln::util::array< T >::resize | ( | unsigned | n | ) | [inline] |
Resize this array to n
elements.
unsigned mln::util::array< T >::size | ( | ) | const [inline] |
Return the number of elements of the array.
Added for compatibility with fun::i2v::array.
References mln::util::array< T >::nelements().
Referenced by mln::value::lut_vec< S, T >::lut_vec(), and mln::labeled_image_base< I, E >::update_data().
const std::vector< T > & mln::util::array< T >::std_vector | ( | ) | const [inline] |
Return the corresponding std::vector of elements.
Referenced by mln::util::array< T >::append(), mln::value::lut_vec< S, T >::lut_vec(), and mln::util::operator==().