Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

RWTPtrSlistIterator<T>

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

Synopsis

#include<rw/tpslist.h>
RWTPtrSlist<T> dl;
RWTPtrSlistIterator<T> itr(dl);

Please Note!


If you have the Standard C++ Library, use the interface described here. Otherwise, use the restricted interface for RWTPtrSlistIterator described in Appendix A.


Description

RWTPtrSlistIterator is supplied with Tools 7 to provide an iterator interface to the new Standard Library based collections that has backward compatibility with the container iterators provided in Tools 6.

The order of iteration over an RWTPtrSlist is dependent upon the order of insertion of items into the container.

The current item referenced by this iterator is undefined after construction or after a call to reset(). The iterator becomes valid after being advanced with either a preincrement or operator().

For both operator++ and operator(), iterating past the last element will return a value equivalent to boolean false. Continued increments will return a value equivalent to false until reset() is called.

If the slist is modified, the iterator is no longer valid. This is generally true for all iterators.

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 Constructors

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

Public Member Operators

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

Public Member Functions

RWTPtrSlist<T>*
container() const; 
T*
findNext(const T* a); 
T*
findNext(RWBoolean(*fn)(T*, void*), void* d); 
void
insertAfterPoint(T* p); 
T*
key();
T*
remove();
T*
removeNext(const T*);
T*
removeNext(RWBoolean(*fn)(T*, void*), void* d);
void
reset();
void
reset(RWTPtrSlist<T>& l);


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