Skip to content

Draft: Extend the TranformedRangeView to allow constructing the iterators directly

Summary

The TransformedRangeView is a utility to transform a range (or its iteratoors) during traversal with a function. This is very useful to write special iterations. But when writing containers, one has to implement the begin() and end() function that directly return the iterators. This was not possible with the TransformedRangeViewIterators before, since there a function pointer was stored and not the function itself, making it unusable with lambda expressions, for example. And resulting in lifetime issues when this is overseen.

This MR stores the function directly, in a RegularOptional wrapper, that extends the type by copy/move assignment and default constructability functionality. This was not possible with standard lambda expressions, for example.

Merge request reports