tuples and freeze dried function args

torhu fake at address.dude
Fri Feb 23 09:46:04 PST 2007


I have a function like this:

void f(int, int, int);


I know that I can do this:

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

alias Tuple!(1, 2, 3) args;


And this now works:

f(args);


But I want to go one step further, and store the args somehow.

alias Tuple!(1, 2, 3) OneSetOfArgs;
alias Tuple!(4, 5, 6) AnotherSetOfArgs;


If I have

struct S { */ ...  */};


can I somehow store OneSetOfArgs in a field, so I can do this?

S s;

s.args = OneSetOfArgs;

f(s.args);  // s.args expands into three ints


I take it the answer is 'no'?

Solutions involving wrapping f, or using assembly is not really what I'm 
looking for.


More information about the Digitalmars-d-learn mailing list