R
raan
Is iterators singleton?
I am accessing a map through wrapper functions to it; that allow me to
access the contents of the map as
CUnit &unit = hash.getFirstunit();
while(hash.hasMoreunits())
{
unit = hash.getNextUnit();
}
Thats all about it. A call to getFirstUnit will initialize the
iterator. hasMoreUnits will move the iterator one unit forward and
hasNextUnit will access the next one and so on.
[just a side note, i was trying to implement a hastable with map and
set, so that each branch of the hash is a set protruding from a map
element.]
All fine unitl now. I have another function that is a straight forward
call.
hash.getUnitByName();
I initialise another set of iterators on the stack inside the function
(iterator objects scoped inside that function) which is local to the
function so that i don't disturb the original master iterators that i
keep intact in my class scope. Once I call this function, that will
throw the master iterator off the edge. What is happening here.
~raan
I am accessing a map through wrapper functions to it; that allow me to
access the contents of the map as
CUnit &unit = hash.getFirstunit();
while(hash.hasMoreunits())
{
unit = hash.getNextUnit();
}
Thats all about it. A call to getFirstUnit will initialize the
iterator. hasMoreUnits will move the iterator one unit forward and
hasNextUnit will access the next one and so on.
[just a side note, i was trying to implement a hastable with map and
set, so that each branch of the hash is a set protruding from a map
element.]
All fine unitl now. I have another function that is a straight forward
call.
hash.getUnitByName();
I initialise another set of iterators on the stack inside the function
(iterator objects scoped inside that function) which is local to the
function so that i don't disturb the original master iterators that i
keep intact in my class scope. Once I call this function, that will
throw the master iterator off the edge. What is happening here.
~raan