Help with Template Code
Jarrett Billingsley
kb3ctd2 at yahoo.com
Sat Mar 31 17:55:54 PDT 2007
"Frits van Bommel" <fvbommel at REMwOVExCAPSs.nl> wrote in message
news:eum0c9$2b75$1 at digitalmars.com...
>
> Come on, we can do a bit better than that!
> ---
> template StructCtor()
> {
> static typeof(*this) opCall(typeof(typeof(*this).tupleof) args)
> {
> typeof(*this) t;
>
> foreach(i, arg; args)
> t.tupleof[i] = arg;
>
> return t;
> }
> }
>
> struct S
> {
> int x;
> float y;
> char[] z;
>
> mixin StructCtor;
> }
Ahh, I was hoping that was possible!
More information about the Digitalmars-d-learn
mailing list