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

©Copyright 1996 Rogue Wave Software

RWTPtrSortedDlistIterator<T,C>

Synopsis

#include<rw/tpsrtdli.h>
RWTPtrSortedDlist<T,C> dl;
RWTPtrSortedDlistIterator<T,C> itr(dl);

Standard C++ Library Dependent!


RWTPtrSortedDlistIterator requires the Standard C++ Library.



Description

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

The order of iteration over an RWTPtrSortedDlist is dependent on the comparator object parameter C as applied to the values stored 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 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.

Persistence

None

Examples

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

int main(){
   RWTPtrSortedDlist<RWCString,less<RWCString> > a;
   RWTPtrSortedDlistIterator<RWCString,less<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
Mark
Steve
Steve

Public Constructors

RWTPtrSortedDlistIterator<T,C>(RWTPtrSortedDlist<T,C>& l);

Public Member Operators

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

Public Member Functions

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