Book Image

Learning Boost C++ Libraries

By : Arindam Mukherjee
Book Image

Learning Boost C++ Libraries

By: Arindam Mukherjee

Overview of this book

Table of Contents (19 chapters)
Learning Boost C++ Libraries
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Iteration patterns using Boost.Iterator


Iteration is a fundamental task in most programming problems, whether it is iterating through the elements of a container, a series of natural numbers, or the files in a directory. By abstracting how a collection of values is iterated through, we can write generic code to process such a collection without depending on methods of iteration specific to each collection.

The Standard Library containers expose iterators for this purpose, and the generic algorithms in the Standard Library can operate on any conforming container through its iterators, without depending on the specific type of the container or its internal structure.

The Boost.Iterator library provides a framework for writing iterators for custom classes that conform to the standards and are compatible with algorithms in the Standard Library. It also helps generalize iteration concepts to more abstract object collections, not limited to containers.

Smart iteration using Boost.Iterator

The Boost...