Ranges to deal with corner cases and "random access"
9il
ilyayaroshenko at gmail.com
Sun Oct 6 05:43:41 UTC 2019
On Saturday, 5 October 2019 at 00:38:06 UTC, Brett wrote:
> Typically a lot of algorithms have corner cases such as
> referencing elements that end up out of bounds at the start or
> end (k-c or k+c).
>
> [...]
mir-algorithm package provides lazy padding and concatenation
routines
http://mir-algorithm.libmir.org/mir_ndslice_concatenation.html
It may be slightly more complex then you expect as the library
was created for a multidimensional random-access ranges
(ndslices).
Lazy `Concatenation` structure can be effectively eagerly
evaluated to a memory allocated ndslice or be lazily iterated
using `opIndex` for random access or input range primitives for
sequential access. It doesn't provide a backward range primitive
but you are welcome to open PR to add them if required.
Best,
Ilya
More information about the Digitalmars-d-learn
mailing list