rotator

Range that rotate elements.

  1. Rotator!Range rotator(Range r)
    Rotator!Range
    rotator
    (
    Range
    )
    (
    Range r
    )
  2. struct Rotator(Range)

Examples

import std.algorithm : equal, cmp;
import std.array : array;
int[] a = [1, 2, 3];
assert(equal!equal(a.rotator, [
    [1, 2, 3],
    [2, 3, 1],
    [3, 1, 2],
]));
int[] b = [3, 1, 4, 1, 5];
assert(equal(b.rotator.maximum!"cmp(a, b) == -1", [5, 3, 1, 4, 1]));

Meta