Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

RWTPtrSetIterator<T,C>

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

Synopsis

#include<rw/tpset.h>
RWTPtrSet<T,C> set;
RWTPtrSetIterator<T,C> itr(set);

Standard C++ Library Dependent!


RWTPtrSetIterator requires the Standard C++ Library.


Description

RWTPtrSetIterator 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 RWTPtrSet is dependent on the comparator object supplied 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/tpset.h>
#include<iostream.h>
#include<rw/cstring.h>
int main(){
   RWTPtrSet<RWCString,less<RWCString> > a;
   RWTPtrSetIterator<RWCString,less<RWCString> > itr(a);
   a.insert(new RWCString("John"));
   a.insert(new RWCString("Steve"));
   a.insert(new RWCString("Mark"));
//Rejected, duplicate insertions not allowed
   a.insert(new RWCString("Steve"));
   for(;itr();)
     cout << *itr.key() <<endl;
   return 0;
}

Program Output
John
Mark
Steve

Public Constructors

RWTPtrSetIterator<T,C>(const RWTPtrSet<T,C>& s);

Public Member Operators

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

Public Member Functions

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


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