RWTPtrMultiSetIterator(3C++)

RWTPtrMultiSetIterator<T,C> - Rogue Wave library class

As shipped in IRIX 6.5.15. Unchanged since IRIX 6.5.

Name
     RWTPtrMultiSetIterator<T,C> - Rogue Wave library class

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

Public Constructors
     Steve



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


     Creates an iterator for the multi-set m.  The iterator begins in an
     undefined state and must be advanced before the first element will be
     accessible

Public Member Operators
              T*
          operator()();


     Advances self to the next element, dereferences the resulting iterator
     and returns its value.  If the iterator has advanced past the last item
     in the container,  the element returned will be a nil pointer equivalent
     to boolean false.

              RWBoolean
          operator++();


     Advances self to the next element.  If the iterator has been reset or
     just created self will now reference the first element.  If, before
     iteration, self referenced the last association in the multi-set, self
     will now point to an undefined value and a value equivalent to false will
     be returned.  Otherwise, a value equivalent to true is returned. Note: no
     post-increment operator is provided.

Public Member Functions
              RWTPtrMultiSet<T,C>*
          container() const;


     Returns a pointer to the collection being iterated over.

              T*
          key();


     Returns the stored value referenced by self.  Undefined if self is not
     referencing a value within the list.

              void
          reset();
          void
          reset(RWTPtrMultiSet<T,C>& h);


     Resets the iterator so that after being advanced it will reference the
     first element of the collection.  Using reset() with no argument will
     reset the iterator on the current container.  Supplying a RWTPtrMultiSet
     with reset() will reset the iterator on that container.