Re:Writing a custom iterator in modern C++
by pumpkinpal on Sunday December 20, 2020 @11:11PM
(#25492058)
Boost STL Interfaces provides this functionality as a library. Not just for iterators but both views and containers of sequences too.
https://www.boost.org/doc/libs/1_75_0/doc/html/stl_interface...
A DSL could codify rules like the ones described in this article and generate at least a rough first pass to be hand-tuned later.