Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

RWTPtrSlistIterator<T>

Alternative interface: no Standard C++ Library

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <rw/tpslist.h>
RWTPtrSlist<T> list;
RWTPtrSlistIterator<T> iterator(list);

Please Note!


If you do not have the Standard C++ Library, use the interface described here. Otherwise, use the interface to RWTPtrSlistIterator described in the Class Reference.


Description

Iterator for class RWTPtrSlist<T>, allowing sequential access to all the elements of a singly-linked parameterized list. Elements are accessed in order, from first to last.

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

If the slist is modified, the iterator is no longer valid. In addition, once the iterator has advanced beyond the end of the collection it is no longer valid--continuing to use it will bring undefined results.

Persistence

None

Example

#include<rw/tpslist.h>
#include<iostream.h>
#include<rw/cstring.h>
int main(){
   RWTPtrSlist<RWCString> a;
   RWTPtrSlistIterator<RWCString> itr(a);
   a.insert(new RWCString("John"));
   a.insert(new RWCString("Steve"));
   a.insert(new RWCString("Mark"));
   a.insert(new RWCString("Steve"));
   for(;itr();)
     cout << *itr.key() <<endl;
   return 0;
}

Program Output
John
Steve
Mark
Steve

Public Constructor

RWTPtrSlistIterator<T>(RWTPtrSlist<T>& c);

Public Member Operators

RWBoolean
operator++();
RWBoolean
operator+=(size_t n);
T*
operator()();

Public Member Functions

RWTPtrSlist<T>*
container() const;
T*
findNext(const T* a);
T*
findNext(RWBoolean (*testFun)(T*, void*), void*);
void
insertAfterPoint(T* a);
T*
key() const;
T*
remove();
T*
removeNext(const T* a);
T*
removeNext(RWBoolean (*testFun)(T*, void*), void*);
void
reset();
void
reset(RWTPtrSlist<T>& c);


Previous fileTop of documentContentsIndexNext file
Return to the main class reference
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.