View source code
Display the source code in std/meta.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Alias std.meta.Stride

Selects a subset of Args by stepping with fixed stepSize over the sequence. A negative stepSize starts iteration with the last element.

alias Stride(int stepSize, Args...) = AliasSeq!();

Parameters

NameDescription
stepSize Number of elements to increment on each iteration. Can't be 0.
Args Template arguments.

Returns

An AliasSeq filtered by the selected stride.

Example

static assert(is(Stride!(1, short, int, long) == AliasSeq!(short, int, long)));
static assert(is(Stride!(2, short, int, long) == AliasSeq!(short, long)));
static assert(is(Stride!(-1, short, int, long) == AliasSeq!(long, int, short)));
static assert(is(Stride!(-2, short, int, long) == AliasSeq!(long, short)));

alias attribs = AliasSeq!(short, int, long, ushort, uint, ulong);
static assert(is(Stride!(3, attribs) == AliasSeq!(short, ushort)));
static assert(is(Stride!(3, attribs[1 .. $]) == AliasSeq!(int, uint)));
static assert(is(Stride!(-3, attribs) == AliasSeq!(ulong, long)));

Authors

Walter Bright, David Nadlinger

License

Boost License 1.0.