Tuple literal syntax
Simen kjaeraas
simen.kjaras at gmail.com
Thu Oct 7 13:45:19 PDT 2010
retard <re at tard.com.invalid> wrote:
> I guess the other places of confusion
> are interaction with built-in statements and other features, e.g.
>
> auto foo = (1,2,3);
>
> auto bar = [foo];
>
> Should there be some way to construct a [1,2,3] array from the tuple or
> should the only be a way to construct arrays of the type tuple!(int)[] or
> something similar.
The obvious way to do this:
CommonType!T buildArray( T... )( T arg ) {
return [ arg ];
}
auto foo = tuple( 1, 2, 3 );
auto bar = buildArray( foo.expand );
--
Simen
More information about the Digitalmars-d
mailing list