Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

WvList< T >::Iter Class Reference

#include <wvlinklist.h>

List of all members.


Detailed Description

template<class T>
class WvList< T >::Iter

The iterator type for linked lists.

An iterator instance does not initially point to any valid elements in a list. Before using, it must be reset using rewind() which causes it to point to an imaginary element located before the first elements in the list. Then next() must be invoked to incrementally move the iterator along the list to first element, and then later to the second, third, and subsequent elements.


Public Member Functions

 Iter (const WvList &l)
 Binds the iterator to the specified list.
T * ptr () const
 Returns a pointer to the current element.
 WvIterStuff (T)
void unlink ()
 Unlinks the current element from the list and automatically increments the iterator to point to the next element as if next() had been called.
void xunlink ()
 Unlinks the current element from the list but unlike unlink() automatically returns the iterator to the previous link in the list such that next() must be called to obtain the next element.


Constructor & Destructor Documentation

template<class T>
WvList< T >::Iter::Iter const WvList l  )  [inline]
 

Binds the iterator to the specified list.

"l" is the list


Member Function Documentation

template<class T>
T* WvList< T >::Iter::ptr  )  const [inline]
 

Returns a pointer to the current element.

Returns: the element pointer, possibly null

template<class T>
void WvList< T >::Iter::xunlink  )  [inline]
 

Unlinks the current element from the list but unlike unlink() automatically returns the iterator to the previous link in the list such that next() must be called to obtain the next element.

This version allows for writing neater loop structures since an element can be unlinked in mid-traversal while still allowing the iterator to be incremented at the top of the loop as usual.

Calling xunlink() twice in a row is currently unsupported.


The documentation for this class was generated from the following file:
Generated on Sun Jul 10 16:28:58 2005 for WvStreams by  doxygen 1.4.0