Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add iterator_wrapping convenience container
authorMaxwell Pirtle <maxwellpirtle@gmail.com>
Mon, 6 Mar 2023 13:01:48 +0000 (14:01 +0100)
committerMaxwell Pirtle <maxwellpirtle@gmail.com>
Mon, 6 Mar 2023 13:27:31 +0000 (14:27 +0100)
commitaf783aa2cd9a69a50e4d88c0094bf9098f88e609
treec6eaf13bf26e01decd5c12a4e721e0ecdd66f438
parenta449af6bf417de8738f029835e10ac0c21e82730
Add iterator_wrapping convenience container

The iterator_wrapping structure is a light-weight
container whose contents are traversed according
to the behavior of the iterator that it creates
when asked. The wrapping can only construct
a container around an iterator whose termination
condition can be succinctly represented with a
default-constructed argument. It is not always
the case that such a default-constructed iterator
represents the end, so this should be kept in made
(although this is generally the convention).

Creating an instance of a wrapping allows, e.g.,
for the traversal over a collection without explicit
need to construct the iterators/loop manually.
For example, a struct `Iterable` may define a method
`make_complicated_forward_iterator_over_me()`
that can be called and used inside e.g. an auto-based
for-loop. This helps with readability immensely.
MANIFEST.in
src/xbt/utils/iter/iterator_wrapping.hpp [new file with mode: 0644]
tools/cmake/DefinePackages.cmake