This class implements a sparse vector as a linear array of elements, pairs of identifiers and values.
| identifier_base | The type of element identifier. | |
| value_base | The type of element values. |
Public Types | |
| typedef identifier_base | identifier_type |
| A type representing an element identifier. | |
| typedef value_base | value_type |
| A type representing an element value. | |
|
typedef std::pair< identifier_type, value_type > | element_type |
| A type representing an element, a pair of (identifier, value). | |
| typedef std::vector< element_type > | container_type |
| A type providing a container of (identifier, value) pairs. | |
| typedef container_type::size_type | size_type |
| A type counting the number of pairs in a container. | |
| typedef container_type::iterator | iterator |
| A type providing a random-access iterator. | |
| typedef container_type::const_iterator | const_iterator |
| A type providing a read-only random-access iterator. | |
Public Member Functions | |
| sparse_vector_base () | |
| Constructs a sparse vector. | |
| virtual | ~sparse_vector_base () |
| Destructs the sparse vector. | |
| void | clear () |
| Erases all the elements of the vector. | |
| bool | empty () const |
| Tests if the sparse vector is empty. | |
| size_type | size () const |
| Returns the number of elements in the vector. | |
| iterator | begin () |
| Returns a random-access iterator to the first element. | |
| const_iterator | begin () const |
| Returns a random-access iterator to the first element. | |
| iterator | end () |
| Returns a random-access iterator pointing just beyond the last element. | |
| const_iterator | end () const |
| Returns a random-access iterator pointing just beyond the last element. | |
| void | append (const identifier_type &id, const value_type &value) |
| Appends an element (name, value) to the end of the vector. | |
Protected Attributes | |
| container_type | cont |
| A container of (identifier, value) pairs. | |
| bool classias::sparse_vector_base< identifier_base, value_base >::empty | ( | ) | const [inline] |
Tests if the sparse vector is empty.
| bool | true if the sparse vector is empty, false otherwise. |
| size_type classias::sparse_vector_base< identifier_base, value_base >::size | ( | ) | const [inline] |
Returns the number of elements in the vector.
| size_type | The current size of the sparse vector. |
| iterator classias::sparse_vector_base< identifier_base, value_base >::begin | ( | ) | [inline] |
Returns a random-access iterator to the first element.
| iterator | A random-access iterator (for read/write) addressing the first element in the vector or to the location succeeding an empty element. |
| const_iterator classias::sparse_vector_base< identifier_base, value_base >::begin | ( | ) | const [inline] |
Returns a random-access iterator to the first element.
| iterator | A random-access iterator (for read-only) addressing the first element in the vector or to the location succeeding an empty element. |
| iterator classias::sparse_vector_base< identifier_base, value_base >::end | ( | ) | [inline] |
Returns a random-access iterator pointing just beyond the last element.
| iterator | A random-access iterator (for read/write) addressing the end of the element. |
| const_iterator classias::sparse_vector_base< identifier_base, value_base >::end | ( | ) | const [inline] |
Returns a random-access iterator pointing just beyond the last element.
| iterator | A random-access iterator (for read-only) addressing the end of the element. |
| void classias::sparse_vector_base< identifier_base, value_base >::append | ( | const identifier_type & | id, | |
| const value_type & | value | |||
| ) | [inline] |
Appends an element (name, value) to the end of the vector.
| id | The element identifier. | |
| value | The element value. |