Patterns in C: iterator