O'Reilly logo

Extended STL, Volume 1: Collections and Iterators by Matthew Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 43. Composite Iterator Adaptations

 

Show me your flow charts and conceal your tables and I shall continue to be mystified. Show me your tables and I usually won’t need your flow charts; they’ll be obvious.

 
 --Frederick P. Brooks
 

But if less is more, think how much more more would be!

 
 --Dr. Frasier Crane, Frasier

Introduction

Naturally, you will now be pondering whether, and how, iterator adaptations may be used in concert. Well, the good news is that they can. The even better news is that you don’t need to write a new iterator adaptor in order to combine them!

Transforming a Filtered Iterator

Let’s imagine that we have a set of integers (int) and that we want to filter out the odd ones and then transform the remaining elements to double

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required