"kbenson" wrote:
the GetIndex() method (without an offset) returns the currently indexed item, and advances the pointer to the next item, sort of like Next() in many linked list implementations. That would be the appropriate way to iterate efficiently through an roList.
I only mention it because your original comparison of the ifList and ifArray interfaces didn't mention it, and neither did your commentary, so it may have confused some as to how an roList could be efficiently used.
I did not say roList cannot be iterated, i was very specific about not using numeric indexing. roList is enumerable, so one can use
ifEnum.reset()/next()/isNext(), and by extension
for each x
in roList.
Sure, you can try iterating with
ifList.ResetIndex()/GetIndex() too but this is kinda broken: how would you know when end of list is reached?
GetIndex() returns
invalid if (a) end of list is reached or (b) if current element=
invalid, so those are indistinguishable. That smells to me.
There is also another method
RemoveIndex(), which i for the life of me cannot imagine in use. It would erase the "current" element (as per ResetIndex/GetIndex iterator) but how do you know what exactly are you deleting? You cannot "peek" at current element, because GetIndex moves to the next one and then current becomes unreachable previous. So have to delete blind (by resetindex() and getIndex() count to N? that is slow). And there is no counterpart
InsertIndex(el) ...
Also, why does
ResetIndex() return boolean while
reset() is void? I am wary of these 3 methods.