Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

RWTValSlistIterator<T>

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

Synopsis

#include<rw/tvslist.h>
RWTValSlist<T> dl;
RWTValSlistIterator<T> itr(dl);

Please Note!


If you have the Standard C++ Library, use the interface described here. Otherwise, use the restricted interface to RWTValSlistIterator described in Appendix A.


Description

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

The order of iteration over an RWTValSlist is dependent on the order of insertion of the values into 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 equal 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

Example

#include<rw/tvslist.h>
#include<iostream.h>
#include<rw/cstring.h>
int main(){
   RWTValSlist<RWCString> a;
   RWTValSlistIterator<RWCString> itr(a);
   a.insert("John");
   a.insert("Steve");
   a.insert("Mark");
   a.insert("Steve");
   for(;itr();)
     cout << itr.key() << endl;
   return 0;
}

Program Output
John
Steve
Mark
Steve

Public Constructors

RWTValSlistIterator<T>(RWTValSlist<T>& s); 

Public Member Operators

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

Public Member Functions

RWTValSlist<T>*
container() const; 
RWBoolean
findNext(const_reference a); 
RWBoolean
findNext(RWBoolean(*fn)(const_reference, void*), void* d);
void
insertAfterPoint(T* p); 
T
key();
RWBoolean
remove();
RWBoolean
removeNext(const T); 
RWBoolean
removeNext(RWBoolean(*fn)(T, void*), void* d);
void
reset();
void
reset(RWTValSlist<T>& l);


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