iterator Class

class iterator: public const_iterator

The iterator templated class is an STL-like iterator that can be instantiated and attached to any collection that implements the  ITraversableT templated interface. Unlike STL's iterators, this iterator class is polymorphic, meaning it can traverse a collection without explicit knowledge of the collection's type. The iterator class 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, this 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: iteratorbeginendat_beginat_endoperator*operator-> operator++ operator++operator--operator--operator==operator!=operator=

Class Members

iterator(typename qualified_traversable_type* pt)

Constructs an iterator and attaches it to the specified traversable

iterator(typename const iterator<_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 reference operator*() const

Returns a reference to the element at the current iterator position

typename pointer operator->() const

Returns a pointer to the element at the current iterator position

typename iterator& operator++()

The preincrement operator advances the iterator by one position and returns *this

typename iterator operator++(int)

The postincrement operator advances the iterator by one position and returns an unmoved *this

typename iterator& operator--()

The predecrement operator retreats the iterator by one position and returns *this

typename iterator operator--(int)

The predecrement operator retreats the iterator by one position and returns an unmoved *this

const_attach(iter.m_pct)

This iterator is set equal to the given one

void erase()

Erases the element at the current iterator position

void insert(typename const _Ty& _X)

Insert the given element at the current iterator position