Treat a normal function as variadic?
Robin Allen
r.a3 at ntlworld.com
Wed May 30 13:48:18 PDT 2007
Jarrett Billingsley wrote:
> "Robin Allen" <r.a3 at ntlworld.com> wrote in message
> news:f3k9n0$45g$1 at digitalmars.com...
>> Thanks, this is how I had been trying to do it before giving up and trying
>> it the hacky way.
>>
>> By the looks of your code, I almost had it, too, I just assumed that this
>> bit would be impossible:
>>
>> args[i] = params[i].convertTo!(typeof(args[i]));
>>
>> because args is a tuple and the docs say the "number and contents of tuple
>> elements are fixed at compile time". Is that wrong?
>
> What I've done in my example is declare a variable tuple by doing Args
> args;. So Args is a tuple of types, and args is a tuple of variables whose
> types are those of Args. Because args is a tuple of variables, I can modify
> their values. I guess it would be a "symbol tuple." So if you want to get
> really technical, args is a tuple which refers to some variables -- you
> can't change the contents of args, i.e. you can't change what symbols it
> refers to, but you can change the values of those symbols.
>
> Or something like that. I'm not really, entirely sure :)
>
>
Thanks for the explanation! I never twigged that type tuples were actual
types that you could declare things with.
More information about the Digitalmars-d-learn
mailing list