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

©Copyright 1996 Rogue Wave Software

RWTValDlistIterator<T>

Synopsis

#include<rw/tvdlist.h>
RWTValDlist<T> dl;
RWTValDlistIterator<T> itr(dl);

Please Note!


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



Description

RWTValDlistIterator provides an iterator interface to the Tools.h++ 7 Standard Library based collections which is compatible with the iterator interface provided for the Tools.h++ 6.x containers.

The order of iteration over an RWTValDlist is dependent on the order of insertion of the values 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 equal to false until reset() is called.

Persistence

None

Examples

#include<rw/tvdlist.h>
#include<iostream.h>
#include<rw/cstring.h>
int main(){
   RWTValDlist<RWCString> a;
   RWTValDlistIterator<RWCString> itr(a);
   a.insert("John");
   a.insert("Steve");
   a.insert("Mark");
   a.insert("Steve");
   for(;itr();)
     cout << itr.key() << endl;
   return 0;
}

Program Output
John
Steve
Mark
Steve

Public Constructors

RWTValDlistIterator<T>(RWTValDlist<T>& s); 




Public Member Operators

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

Public Member Functions

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