Chapter 5.  Sequences and Iterators
Team LiB
Previous Section Next Section

Chapter 5. Sequences and Iterators

If the STL can be described as a framework based on runtime algorithms, function objects, and iterators, we could say that the MPL is founded on compile-time algorithms, metafunctions, sequences, and iterators.[1]

[1] Though indispensable in everyday programming, STL containers are not a fundamental part of that library's conceptual framework, and they don't interact directly with the other STL abstractions. By contrast, MPL's sequences play a direct role in its algorithm interfaces.

We used sequences and algorithms informally in Chapter 3 to implement our dimensional analysis logic. If you're familiar with the STL, you might have guessed that under the hood we were also using iterators. The library, however, has so far allowed us to remain happily ignorant of their role, by virtue of its sequence-based algorithm interfaces.

In this chapter you will gain a general familiarity with "compile-time STL," and then proceed to formalize sequences and iterators, study their interactions with algorithms, look at a number of specific implementations offered by the library, and learn how to implement new examples of each one.

    Team LiB
    Previous Section Next Section