License:
Authors:
NOTE:
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | alias Tuple!(int, real) T1; alias Tuple!(int, long) T2; struct Wrap( Vals... ) { Vals val; } Wrap!(T2) func( T1 val ) { Wrap!(T2) ret; ret.val[0] = val[0]; ret.val[1] = val[0] * cast(long) val[1]; return ret; } |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | alias Tuple!(int, real) T1; alias Tuple!(int, long) T2; T2 func( T1 val ) { T2 ret; ret[0] = val[0]; ret[1] = val[0] * cast(long) val[1]; return ret; } // tuples may be composed alias Tuple!(int) IntTuple; alias Tuple!(IntTuple, long) RetTuple; // tuples are equivalent to a set of function parameters of the same type RetTuple t = func( 1, 2.3 ); |