Rogue Wave Views
Foundation Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions
IlListIteratorOf(NAME) Class Reference

An unsafe iterator of lists. More...

#include <ilog/list.h>

Public Member Functions

 IlListIteratorOf(NAME) (const IlListOf(NAME) &list)
 Constructor. More...
 
IlBoolean hasMoreElements () const
 Indicates that the enumeration can carry on. More...
 
TYPE nextElement ()
 Returns the next element in the list. More...
 

Detailed Description

An unsafe iterator of lists.

Library: ilog

This class is generated by the macro IlDefineListOf(NAME, TYPE).
It allows the iteration on a list in a very simple manner. A typical use of this class is shown here:

IlListOf(Name) myList;
...
for (IlListIteratorOf(Name) i(myList); i.hasMoreElements(); ) {
DoSomethingWith(i.nextElement());
}

This version of the class doesn't allow you to modify the list while you are iterating it. Use the class IlSafeListIteratorOf(NAME) if you plan to modify the list during its iteration.

See also
IlListOf(NAME), IlSafeListIteratorOf(NAME).

Constructor & Destructor Documentation

§ IlListIteratorOf(NAME)()

IlListIteratorOf(NAME)::IlListIteratorOf(NAME) ( const IlListOf(NAME) list)

Constructor.

Initializes a new iterator for the indicated list. The current position is set to the beginning of the list.

Parameters
listA reference to the iterated list.

Member Function Documentation

§ hasMoreElements()

IlBoolean IlListIteratorOf(NAME)::hasMoreElements ( ) const

Indicates that the enumeration can carry on.

If this member function returns IlFalse, you must not call nextElement().

Returns
IlTrue if the list is still valid, and there are more elements to iterate. It returns IlFalse if the list is invalid or if the iterator has reached the end of the list.

§ nextElement()

TYPE IlListIteratorOf(NAME)::nextElement ( )

Returns the next element in the list.

This member function also make the iterator point to the next element of the list.

Returns
The next element of the list.

© Copyright 2017, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.