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

©Copyright 1996 Rogue Wave Software

RWTPtrDlistIterator<T>

Synopsis

#include<rw/tpdlist.h>
RWTPtrDlist<T> dl;
RWTPtrDlistIterator<T> itr(dl);

Please Note!


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


Description

RWTPtrDlistIterator provides an iterator interface to the Tools 7 Standard C++ Library-based collections which is compatible with the iterator interface provided for the Tools.h++ 6.xcontainers.

The order of iteration over an RWTPtrDlist is dependent on the order of the values in 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 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. For operator--, decrementing past the first element will return a value equivalent to false.

Persistence

None

Examples

#include<rw/tpdlist.h>
#include<iostream.h>
#include<rw/cstring.h>

int main(){
   RWTPtrDlist<RWCString> a;
   RWTPtrDlistIterator<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

RWTPtrDlistIterator<T>(RWTPtrDlist<T>& l);

Public Member Operators

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

Public Member Functions

RWTPtrDlist<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(RWTPtrDlist<T>& l*);