...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Boost.Iterator is a library that is already in Boost, and it has been around for a long time.
However, it was attempting to solve a lot of problems related to iterators, not just how to write them from scratch. It is also not easy to modernize it for use in C++11 and later. Specifically:
- Boost.Iterator contains a large number of iterator adaptors; those have since been rendered moot by C++20 ranges.
- Boost.Iterator's
iterator_facade
template is
not limited just to the existing standard C++ iterator categories; that was
an experiment that never landed in standard C++, so it adds needless complexity.
- Boost.Iterator's
iterator_facade
was written
against C++98, so it is not constexpr
-
and noexcept
-friendly.
- Boost.Iterator's
iterator_facade
does not support
proxy iterators, which are fully supported by the C++20 iterator concepts.
- There is opportunity to reduce the amount of code the user must write in
order to use iterator_facade
.
- Boost.Iterator
contains two templates, iterator_facade
and iterator_adaptor
, that
represent two ways of writing a new iterator while writing as little code as
possible. It would be nice to have the functionality for both available in
one template, but it is difficult to unify those two templates as written.
For these reasons, it seems more appropriate to introduce a new Boost library
than to try and address the shortcomings of Boost.Iterator's
iterator_facade
and iterator_adaptor
templates directly.