LUMIERA.clone/tests/library
Ichthyostega b6bdcc068d Library: investigate how a »zip iterator« can be built
Basically I am sick of writing for-loops in those cases
where the actual iteration is based on one or several data sources,
and I just need some damn index counter. Nothing against for-loops
in general — they have their valid uses — sometimes a for-loop is KISS

But in these typical cases, an iterator-based solution would be a
one-liner, when also exploiting the structured bindings of C++17

''I must admit that I want this for a loooooong time —''
...but always got intimidated again when thinking through the fine points.
Basically it „should be dead simple“ — as they say

Well — — it ''is'' simple, after getting the nasty aspects of tuple binding
and reference data types out of the way. Yesterday, while writing those
`TestFrame` test cases (which are again an example where you want to iterate
over two word sequences simultaneously and just compare them), I noticed that
last year I learned about the `std::apply`-to-fold-expression trick, and
that this solution pattern could be adapted to construct a tuple directly,
thereby circumventing most of the problems related to ''perfect forwarding''

So now we have a new util function `mapEach` (defined in `tuple-helper.hpp`)
and I have learned how to make this application completely generic.

As a second step, I implemented a proof-of-concept in `IterZip_test`,
which indeed was not really challenging, because the `IterExplorer`
is so very sophisticated by now and handles most cases with transparent
type-driven adaptors. A lot of work went into `IterExplorer` over the years,
and this pays off now.

The solution works as follows:
 * apply the `lib::explore()` constructor function to the varargs
 * package the resulting `IterExplorer` instantiations into a tuple
 * build a »state core« implementation which just lifts out the three
   iterator primitives onto this ''product type'' (i.e. the tuple)
 * wrap it in yet another `IterExplorer`
 * add a transformer function on top to extract a value-tuple for each ''yield'

As expected, works out-of-the-box, with all conceivable variants and wild
mixes of iterators, const, pointers, references, you name it....

PS: I changed the rendering of unsigned types in diagnostic output
    to use the short notation, e.g. `uint` instead of `unsigned int`.
    This dramatically improves the legibility of verification strings.
2024-11-22 22:07:39 +01:00
..
advice Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
c-lib Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
diff Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
idi Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
meta Library: shorten display of unsigned types 2024-11-22 22:02:45 +01:00
query Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
stat Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
test Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
allocation-cluster-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
app-config-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
builder-qualifier-support-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
cmdline-wrapper-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
custom-shared-ptr-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
del-stash-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
DIR_INFO
exception-error-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
format-cout-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
format-helper-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
format-string-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
gnuplot-gen-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
hash-generator-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
hash-indexed-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
hash-standard-to-boost-bridge-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
helloworldtest.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
incidence-count-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
index-iter-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
ios-savepoint-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
item-wrapper-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
iter-adapter-stl-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
iter-adapter-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
iter-chain-search-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
iter-cursor-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
iter-explorer-test.cpp Library: investigate how a »zip iterator« can be built 2024-11-22 22:07:39 +01:00
iter-queue-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
iter-source-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
iter-stack-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
iter-zip-test.cpp Library: investigate how a »zip iterator« can be built 2024-11-22 22:07:39 +01:00
itertools-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
lazy-init-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
life-cycle-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
linked-elements-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
multifact-argument-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
multifact-singleton-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
multifact-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
null-value-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
opaque-holder-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
opaque-unchecked-buffer-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
optional-ref-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
path-array-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
polymorphic-value-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
query-text-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
random-concurrent-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
random-draw-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
random-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
rational-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
ref-array-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
removefromsettest.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
replaceable-item-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
result-test.cpp Library: shorten display of unsigned types 2024-11-22 22:02:45 +01:00
scoped-collection-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
scoped-holder-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
scoped-holder-transfer-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
scoped-ptrvect-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
search-path-splitter-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
several-builder-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
simple-allocator-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
split-splice-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
sub-id-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
symbol-hashtable-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
symbol-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
sync-barrier-performance-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
sync-barrier-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
sync-classlock-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
sync-locking-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
sync-timedwait-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
sync-waiting-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
text-template-test.cpp Library: investigate how a »zip iterator« can be built 2024-11-22 22:07:39 +01:00
thread-wrapper-autonomous-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
thread-wrapper-join-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
thread-wrapper-lifecycle-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
thread-wrapper-self-recognition-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
thread-wrapper-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
typed-allocation-manager-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
unique-malloc-owner-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
util-collection-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
util-floordiv-test.cpp Library: shorten display of unsigned types 2024-11-22 22:02:45 +01:00
util-floorwrap-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
util-foreach-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
util-identity-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
util-parse-bool-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
util-sanitised-identifier-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
util-tuple-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
variant-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
vector-transfer-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
verb-function-dispatch-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00
verb-visitor-dispatch-test.cpp Copyright: clarify and simplify the file headers 2024-11-17 23:42:55 +01:00