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

©Copyright 1996 Rogue Wave Software

RWTPtrMultiSetIterator<T,C>

Synopsis

#include<rw/tpmset.h>
RWTPtrMultiSet<T,C> set;
RWTPtrMultiSetIterator<T,C> itr(set);

Standard C++ Library Dependent!


RWTPtrMultiSetIterator requires the Standard C++ Library.


Description

RWTPtrMultiSetIterator 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 RWTPtrMultiSet is dependent upon 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/tpmset.h>
#include<iostream.h>
#include<rw/cstring.h>
int main(){
   RWTPtrMultiSet<RWCString, less<RWCString> > a;
   RWTPtrMultiSetIterator<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

RWTPtrMultiSetIterator<T,C>(const RWTPtrMultiSet<T,C>& m);

Public Member Operators

T*
operator()();
RWBoolean
operator++();

Public Member Functions

RWTPtrMultiSet<T,C>*
container() const;
T*
key();
void
reset();
void
reset(RWTPtrMultiSet<T,C>& h);