Generic base class for adding support for iteration to index-based container classes.
More...
template<typename
ContainerType, bool IsConst = false, typename ValueType = typename ContainerType::value_type, typename SizeType = typename ContainerType::size_type, typename
DifferenceType = typename ContainerType::difference_type, typename AccessorType = IndexBasedIteratorPrivate::DefaultAccessor<ContainerType, IsConst, SizeType, ValueType>>
class CSIRO::Application::IndexBasedIterator< ContainerType, IsConst, ValueType, SizeType, DifferenceType, AccessorType >
Generally typedefs of this class will be declared inside the public section of the class definition. For example:
typedef Application::IndexBasedIterator<InputArray, InputScalar, true> const_iterator; typedef Application::IndexBasedIterator<InputArray, InputScalar, false> iterator;
Methods can then be defined to retrieve begin and end iterators:
iterator begin() { return iterator(*this, 0); } const_iterator begin() const { return const_iterator(*this, 0); } iterator end() { return iterator(*this, size()); } const_iterator end() const { return const_iterator(*this, size()); }
- Template Parameters
-
ContainerType | The container type to iterate over |
IsConst | Whether or not the iterator is a const_iterator type |
ValueType | The type of the values to be returned when dereferencing the iterator. Becomes value_type. |
SizeType | The size type of the container. Becomes size_type. |
DifferenceType | The difference type of the container (for when iterators are subtracted). Becomes difference_type. |
AccessorType | Callable access type for retrieving values from the container. Defaults to C::operator[]. |