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.

std.typecons.tuple.this - multiple declarations

Template Tuple.this

Constructor taking a compatible array.

Arguments

template this(U, size_t n);

Functions

Function name Description
this

Parameters

NameDescription
values A compatible static array to build the Tuple from. Array slices are not supported.

Example

int[2] ints;
Tuple!(int, int) t = ints;


Template Tuple.this

Constructor taking a compatible Tuple. Two Tuples are compatible iff they are both of the same length, and, for each type T on the left-hand side, the corresponding type U on the right-hand side can implicitly convert to T.

Arguments

template this(U);

Functions

Function name Description
this

Parameters

NameDescription
another A compatible Tuple to build from. Its type must be compatible with the target Tuple's type.

Example

alias IntVec = Tuple!(int, int, int);
alias DubVec = Tuple!(double, double, double);

IntVec iv = tuple(1, 1, 1);

//Ok, int can implicitly convert to double
DubVec dv = iv;
//Error: double cannot implicitly convert to int
//IntVec iv2 = dv;


Authors

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

License

Boost License 1.0.

Comments