rotator

Range that rotate elements.

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

Examples

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

Meta