in reply to An iterator for (not "iterating") a recursive data structure.

A stack of indexes?

In order to avoid browsing the data structure from the root every time, you may want to keep a stack of pairs (reference, index) instead.

  • Comment on Re: An iterator for (not "iterating") a recursive data structure.