View source code Display the source code in std/typecons.d from which this page was generated on github. 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. Page wiki View or edit the community-maintained wiki page associated with this page.

Template std.typecons.Tuple.slice

Takes a slice of this Tuple.

Arguments

template slice(size_t from, size_t to);

Functions

Function name Description
slice

Parameters

NameDescription
from A size_t designating the starting position of the slice.
to A size_t designating the ending position (exclusive) of the slice.

Returns

A new Tuple that is a slice from [from, to$(RPAREN) of the original. It has the same types and values as the range [from, to$(RPAREN) in the original.

Example

Tuple!(int, string, float, double) a;
a[1] = "abc";
a[2] = 4.5;
auto s = a.slice!(1, 3);
static assert(is(typeof(s) == Tuple!(string, float)));
assert(s[0] == "abc" && s[1] == 4.5);


Authors

Andrei Alexandrescu, Bartosz Milewski, Don Clugston, Shin Fujishiro, Kenji Hara

License

Boost License 1.0.

Comments