Skip to Main Content
Elements of Programming
book

Elements of Programming

by Paul McJones, Alexander Stepanov
June 2009
Intermediate to advanced content levelIntermediate to advanced
288 pages
5h 59m
English
Addison-Wesley Professional
Content preview from Elements of Programming

Chapter 6

Iterators

This chapter introduces the concept of iterator: an interface between algorithms and sequential data structures. A hierarchy of iterator concepts corresponds to different kinds of sequential traversals: single-pass forward, multipass forward, bidirectional, and random access.[1] We investigate a variety of interfaces to common algorithms, such as linear and binary search. Bounded and counted ranges provide a flexible way of defining interfaces for variations of a sequential algorithm.

[1] Our treatment of iterators is a further refinement of the one in Stepanov and Lee [1995] but differs from it in several aspects.

6.1 Readability

Every object has an address: an integer index into computer memory. Addresses allow us to access ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Interviews Exposed, 4th Edition

Programming Interviews Exposed, 4th Edition

John Mongan, Noah Suojanen Kindler, Eric Giguere
The Programmer's Brain

The Programmer's Brain

Felienne Hermans

Publisher Resources

ISBN: 9780321643926Purchase book