forwarding, random access, and slicing.
slide
fn
auto slide(Flag!"withPartial" f = Yes.withPartial,
Source)(Source source, size_t windowSize, size_t stepSize = 1) if (isForwardRange!Source)A fixed-sized sliding window iteration of size windowSize over a source range by a custom stepSize.
The Source range must be at least a ForwardRange and the windowSize must be greater than zero.
For windowSize = 1 it splits the range into single element groups (aka unflatten) For windowSize = 2 it is similar to zip(source, source.save.dropOne).
Parameters
f | Whether the last element has fewer elements than windowSize it should be be ignored (No.withPartial) or added (Yes.withPartial) |
source | Range from which the slide will be selected |
windowSize | Sliding window size |
stepSize | Steps between the windows (by default 1) |
Returns
Range of all sliding windows with propagated bi-directionality,
Note
To avoid performance overhead, bi-directionality
is only available when hasSlicing and hasLength are true.