iterator class reference

This class provides an efficient way to iterate over all elements in a vararray. See the discussion of Iterators in the vararray User's Guide.

iterator (vararray<T>& list)

const_iterator (vararray<T>& list)

constructor, public

The constructor creates an iterator bound to the specified vararray. Initially, the state of the iterator is to refer to the first element.

iterator (vararray<T>& list, make_alias_t)

constructor, public

If the optional parameter (with the constant value alias) is supplied, than the list being iterated will reflect changes made through the iterator, and vice-versa.

T* operator-> () const


The arrow operator is used to treat the iterator object as a smart pointer to the "current" element.

T& operator* () const


Use the * operator rather than the arrow operator when you need to refer to the entire current element, as opposed to individual members of the current element.

operator bool() const


This operator returns true when the iterator refers to a valid position within the vararray. It returns false after all elements have been visited.

bool operator++ ()


The pre-increment operator advances the iterator to the next element. If there is no next element, then the iterator refers to a null element (so subsequent use of -> or * will give an addressing exception).

int index() const


This function returns the state of the iterator as the current array index. This gives you the value you would have used had you subscripted the array instead of using an iterator.
Page content copyright 1998 by John M. Dlugosz. Home:,