tuples and freeze dried function args

torhu fake at address.dude
Wed Feb 28 10:13:05 PST 2007


Bill Baxter wrote:
> I think you may be able to get something like what you want using type 
> tuples and tupleof.
> 
> alias Tuple!(int,int,int) FArgs;
> struct S
> {
>     FArgs OneSetOfArgs;
>     FArgs OtherSetOfArgs;
> }
> S s;
> Foo(s.OneSetOfArgs.tupleof);
> 
> Or something along those lines maybe?

That doesn't work.  I tried something like it.

template Tuple(T...)
{
     alias T Tuple;
}

struct BlockType {
    Tuple!(int, int, int) color;   // line 34
}

blocktypes.d(34): variable blocktypes.BlockType.color is not a 
per-instance initializable field

I guess I'll just go with an array for the color.  It was just intended 
to show off some D features.  But if it's going to get complicated, 
there's no point to it.  It would just be a silly way of doing something 
that's really very simple.


More information about the Digitalmars-d-learn mailing list