Concept: use order and number of elements of some data structure to control iteration
Two strategies:
- "Passive" iterator: provide a set of functions for a data structure that the user can use to construct a loop using while, for, etc.
- "Active" iterator: encapsulate the loop control in an operation, and only allow the user to provide the loop body; in other Words, provide a "functional form" or a template operation for the entire loop
ReportLike(0)ShareFavorite