Iterator pattern (source code)

= Iterator pattern

Expose sequential consumption through availability and next-element operations while hiding storage and traversal details. The abstraction supports common clients for <arrays>, linked structures or generated <sequences>. A separate <iterator> can own separate cursor state; an alias of the same <iterator> does not create an independent traversal.