#include <Iterator.h>
implemented by always storing an iterator to the last item as well as the next (unretrieved) item. Calling next() advances the iterator, returning a reference to the item.
Example:
mace::map<int, int> m; //insert a bunch of members into m mace::ConstMapIterator<mace::map<int, int> > i(m); while (i.hasNext()) { int& key; int& value = i.next(key); maceout << "Key " << key << " -> Value " << value << Log::endl; }
Definition at line 182 of file Iterator.h.
Public Member Functions | |
ConstMapIterator (const M &s) | |
Constructs the map iterator from a map reference (iterator over the whole map). | |
ConstMapIterator (const M &s, const_iterator b) | |
Constructs the map iterator from a map reference and a beginning point (iterates to end()). | |
ConstMapIterator (const M &s, const_iterator b, const_iterator e) | |
Constructs the map iterator from a map reference, a beginning point, and an ending point. | |
bool | hasNext () |
returns whether there are more elements | |
const V & | next () |
returns the present (next) item by const reference, advancing the iterators | |
const V & | next (K &key) |
returns the present (next) item by const reference, and makes a copy of the key into the key reference, advancing the iterators |