Chapter 7. Views and Iterator Adaptors

Algorithms like transform provide one way to operate on sequences. This chapter covers the use of sequence views, a powerful sequence processing idiom that is often superior to the use of algorithms.

First, an informal definition:

Views are lazy: Their elements are only computed on demand. We saw examples of lazy evaluation when we covered nullary metafunctions in Chapter 3 and eval_if in Chapter 4. As with other lazy constructs, views can help us avoid premature errors and inefficiencies from computations whose results will never be used. Also sequence views sometimes ...

Get C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.