Files
ldc/tests/mini/tupleval.d
Christian Kamm 2a999b72e8 Fix VarDecls for tuples. Closes #99.
I've implemented it this way since it doesn't require any changes in the
frontend. However, I think having TypeTuple expressed as LLVM struct types
would make much more sense and open the door to tuple lvalues.
2008-10-05 11:47:47 +02:00

31 lines
584 B
D

module foo;
template ParameterTupleOf( Fn )
{
static if( is( Fn Params == function ) )
alias Params ParameterTupleOf;
else static if( is( Fn Params == delegate ) )
alias ParameterTupleOf!(Params) ParameterTupleOf;
else static if( is( Fn Params == Params* ) )
alias ParameterTupleOf!(Params) ParameterTupleOf;
else
static assert( false, "Argument has no parameters." );
}
struct S
{
int opApply(T)(T dg)
{
alias ParameterTupleOf!(T) U;
U u;
u[0] = 1;
u[1] = 2;
return 0;
}
}
void main()
{
foreach(int x, int y; S()){}
}