Rogue Wave Software logo banner

Click on the banner to return to the Class Reference home page.

©Copyright 1996 Rogue Wave Software

RWGSlistIterator(type)

Synopsis

#include <rw/gslist.h>
declare(RWGSlist, type)

RWGSlist(type) a ;
RWGSlistIterator(type) I(a);

Description

Iterator for class RWGSlist(type), which allows sequential access to all the elements of a singly-linked list. Elements are accessed in order, first to last.

As with all Rogue Wave iterators, the "current item" is undefined immediately after construction -- you must define it by using operator() or some other (valid) operation.

Once the iterator has advanced beyond the end of the collection it is no longer valid -- continuing to use it will bring undefined results.

In order to simplify the documentation below, an imaginary typedef

typedef RWBoolean (*yourTester)(const type*, const void*);

has been used. See the documentation for class RWGSlist(type) for an explanation of this function.

Persistence

None

Public Constructor

RWGSlistIterator(type)( RWGSlist(type)& list);

Public Member Operators

type*
operator()();
void
operator++();
void
operator+=(size_t n);

Public Member Functions

RWBoolean
atFirst() const;
RWBoolean
atLast() const;
type*
findNext(yourTester t,const type* d);
type*
findNextReference(const type* e);
type*
insertAfterPoint(type* a);
type*
key() const;
type*
remove();
type*
removeNext(yourTester t, const type* d);
type*
removeNextReference(const type* e);
void
reset();
void
toFirst();
void
toLast();