Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

RWTValSetIterator<T,C>

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

Synopsis

#include<rw/tvset.h>
RWTValSet<T,C> vs;
RWTValSetIterator<T,C> itr(vs);

Standard C++ Library Dependent!


RWTValSetIterator requires the Standard C++ Library.


Description

RWTValSetIterator is supplied with Tools.h++ 7 to provide an iterator interface for class RWTValSetIterator that is backward compatable with the container iterators provided in Tools.h++ 6.x.

The order of iteration over an RWTValSet is dependent on the supplied 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/tvset.h>
#include<iostream.h>
#include<rw/cstring.h>

int main(){
   RWTValSet<RWCString,greater<RWCString> > a;
   RWTValSetIterator<RWCString,greater<RWCString> > itr(a);

   a.insert("John");
   a.insert("Steve");
   a.insert("Mark");

//Rejected, duplicates are not allowed
   a.insert("Steve");

   for(;itr();)
     cout << itr.key() << endl;

   return 0;
}

Program Output
Steve
Mark
John

Public Constructors

RWTValSetIterator<T,C>(RWTValSet<T,C>&s);

Public Member Operators

RWBoolean
operator()();
RWBoolean
operator++();

Public Member Functions

RWTValSet<T,C>*
container() const; 
T
key() const; 
void
reset();
void
reset(RWTValSet<T,C>& s);


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