Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

RWTPtrSortedDlistIterator<T,C>

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

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.

The value type must have operator== and operator< defined. This requirement is imposed by the Standard C++ Library.

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);


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