Represents an iterator for some type. This is a forward-only iterator in that it can only start at 0 and increment through the items until done. More...
#include <Iterator_Class.h>
Public Member Functions | |
virtual | ~IIterator () |
Virtual destructor so this struct can be used as an interface. | |
virtual void | Reset ()=0 |
Start iteration from beginning of container. | |
virtual bool | Next (TItemType &item)=0 |
Retrieve the next item from the container. | |
Represents an iterator for some type. This is a forward-only iterator in that it can only start at 0 and increment through the items until done.
TItemType | The type of each item provided by the iterator |
var iterator = container.GetItems(); for (var item in iterator.Next(); item != null; item = iterator.Next()) { // Use item here }
A generic type is used in this example so I didn't have to come up with either two iterators (one for ItemPair and the other for string) or one iterator that returned an object that would have to be cast to the appropriate type before using.
Definition at line 72 of file Iterator_Class.h.
|
inlinevirtual |
Virtual destructor so this struct can be used as an interface.
Definition at line 77 of file Iterator_Class.h.
|
pure virtual |
Retrieve the next item from the container.
Implemented in Iterator< TItemType >.
|
pure virtual |
Start iteration from beginning of container.
Implemented in Iterator< TItemType >.