Boost logo

Boost :

From: Barrett Adair (barrettellisadair_at_[hidden])
Date: 2019-08-11 05:10:34


On Sat, Aug 10, 2019 at 9:21 PM Zach Laine via Boost <boost_at_[hidden]>
wrote:
>
> I write a lot of iterators, and I'm getting sick of doing it by hand. I
> can't use Boost.Iterator's iterator_facade in library code, since it knows
> nothing about constexpr and noexcept.
>
> The design of Boost.Iterator's iterator_facade does not lend itself very
> well to being modified in a direction that is standardization-friendly
> (reasons why are outlined in the online docs).
>
> So, here is one take on this problem:
>
> GitHub:
> https://github.com/tzlaine/iterator_facade
>
> Online Docs:
> https://tzlaine.github.io/iterator_facade
>
> For those unfamiliar with the problem, iterators are very simple, at the
> highest level of abstraction. An iterator's implementation does not
> reflect this -- it is highly repetitive and easy to get subtly wrong.
This
> library fixes that.
>
> The library is forward-looking, since I intend to write WG21 papers to
> standardize iterator_facade; there is good support for upcoming C++20
> library features. In particular, the iterators created with
> iterator_facade model the C++20 iterator concepts, and therefore do not
> necessarily match the requirements of the C++17-and-earlier requirement
> tables. I have not found this to affect the usability of
> iterator-facade-based iterators with pre-C++20 code.
>
> Something to note: there was a recent-ish attempt to stanrdize
> iterator_facade, which is now abandoned, P0186 (http://wg21.link/P0186).
> This was very different from what I'm proposing for Boost. I talked to
> Eric Niebler about this, and he favors a return to the CRTP-based approach
> of my lib and the original Boost.Iterator iterator_facade library.
>
> Zach
>

I would definitely use this, and I'd be thrilled to see it in boost. My
sole suggestion would be to consider choosing a name other than
iterator_facade to prevent confusion with the old one. Some potential
candidates, some better than others:
* iterator_veneer
* iterator_face
* iterator_guise
* iterator_disguise
* iterator_outfit
* iterator_costume
* iterator_hat
* iterator_sugar
* iterator_porcelain
* enable_iterator_from_this

> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk