const_iterator Class
class const_iterator
The const_iterator templated class is an STL-like iterator that can be instantiated and attached to any collection that implements the IConstTraversableT templated interface. Unlike STL's iterators, const_iterator is polymorphic, meaning it can traverse a collection without explicit knowledge of the collection's type. const_iterator is a bidirectional type iterator that is interface compatible with its STL counterpart. Therefore, it can be used with any STL algorithm which takes a bidirectional iterator. Note, const_iterator does not support random iteration.Defined in: PolyIter.h
Class Template Arguments
_Ty
The type of element in the collection the iterator is traversing.
Member functions include: const_iteratorbeginendat_beginat_endoperator*operator-> operator++ operator++operator--operator--operator==operator!=operator=
Class Members
const_iterator(typename qualified_traversable_type* pct)
Constructs a const_iterator and attaches it to the specified traversable
const_iterator( typename const const_iterator<typename _Ty>& iter )
Copy constructor for const_iterator
void prev()
Move the iterator to the previous element in the collection
void next()
Move the iterator to the next element in the collection
typename const_reference getref() const
Return a const reference to the element at the iterator's current position
typename const_pointer getptr() const
Return a const pointer to the element at the iterator's current position
void begin()
Positions the iterator at the start of the collection
void end()
Positions the iterator at the end of the collection. Note, the end is one position passed the last element.
bool at_begin() const
Returns true if currently positioned at start of collection
bool at_end() const
Returns true if currently positioned at end of collection
typename const_reference operator*() const
Returns a constant reference to the element at the current iterator position
typename const_pointer operator->() const
Returns a constant pointer to the element at the current iterator position
typename const_iterator& operator++()
The preincrement operator advances the iterator by one position and returns *this
typename const_iterator operator++(int)
The postincrement operator advances the iterator by one position and returns an unmoved *this
typename const_iterator& operator--()
The predecrement operator retreats the iterator by one position and returns *this
typename const_iterator operator--(int)
The predecrement operator retreats the iterator by one position and returns an unmoved *this
bool operator==(typename const const_iterator& _X) const
Returns true if the given iterator is equal to this one
bool operator!=(typename const const_iterator& _X) const
Returns true if the given iterator is not equal to this one
const_attach(iter.m_pct)
This iterator is set equal to the given one