A 1-D array with holes. More...
#include <ArrayWithNullHoles.h>
Public Types | |
| typedef T | ValueType |
| The element type of the array. | |
| typedef Loki::TypeTraits < ValueType >::ParameterType | ParameterType |
| The parameter type. | |
| typedef ValueContainer::pointer | Pointer |
| A pointer to an element. | |
|
typedef ValueContainer::const_pointer | ConstPointer |
| A pointer to a constant element. | |
| typedef ValueContainer::reference | Reference |
| A reference to an array element. | |
|
typedef ValueContainer::const_reference | ConstReference |
| A reference to a constant array element. | |
| typedef int | SizeType |
| The size type is a signed integer. | |
|
typedef ValueContainer::difference_type | DifferenceType |
| Pointer difference type. | |
Public Member Functions | |
Constructors etc. | |
| ArrayWithNullHoles (ParameterType null) | |
| Construct from the null value. | |
| ArrayWithNullHoles (const ArrayWithNullHoles &other) | |
| Copy constructor. Deep copy. | |
| ArrayWithNullHoles & | operator= (const ArrayWithNullHoles &other) |
| Assignment operator. | |
| ~ArrayWithNullHoles () | |
| Destructor. | |
Accessors. | |
| int | size () const |
| Return the size of the array (non-null elements and holes combined). | |
| int | sizeNull () const |
| Return the number of null elements (holes). | |
| int | sizeNonNull () const |
| Return the number of non-null elements. | |
| bool | isNull (int index) const |
| Return true if the specified element is null. | |
| bool | isNonNull (int index) const |
| Return true if the specified element is non-null. | |
| ParameterType | get (int index) const |
| Return the specified element. | |
Manipulators. | |
| int | insert (ParameterType value) |
| Insert an element into a hole (or at the end if there are no holes). | |
| void | erase (int index) |
| Erase the specified element. | |
| template<typename IntInputIterator > | |
| void | erase (IntInputIterator begin, IntInputIterator end) |
| Erase a range of elements. | |
| void | set (int index, ParameterType value) |
| Set the specified element. | |
Validity. | |
| bool | isValid () const |
| Return true if the data structure is valid. | |
A 1-D array with holes.
| T | is the value type. |
| typedef Loki::TypeTraits<ValueType>::ParameterType ArrayWithNullHoles< T >::ParameterType |
The parameter type.
This is used for passing the value type as an argument.
| typedef int ArrayWithNullHoles< T >::SizeType |
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.
| void ArrayWithNullHoles< T >::erase | ( | IntInputIterator | begin, | |
| IntInputIterator | end | |||
| ) | [inline] |
Erase a range of elements.
| void ArrayWithNullHoles< T >::erase | ( | int | index | ) |
Erase the specified element.
| int ArrayWithNullHoles< T >::insert | ( | ParameterType | value | ) |
Insert an element into a hole (or at the end if there are no holes).
| void ArrayWithNullHoles< T >::set | ( | int | index, | |
| ParameterType | value | |||
| ) |
Set the specified element.
1.6.3