Question Re Templates & Tuples

Daniel Giddings dgiddings at bigworldtech.com
Mon Jan 15 21:13:44 PST 2007


Cheers,

align(1) struct Tuple( T... )
{
	T fields;
}

works quite nicely with no other changes!

:-) Dan

Chris Nicholson-Sauls wrote:
> 
> I did something like the following once:
> 
> # struct Foo (T ...) {
> #   T fields;
> # }
> 
> And was later able to access the declared fields via an index.  Aka:
> Foo!(int, int, float, bool) myfoo;
> myfoo.fields[0] = 42;
> myfoo.fields[2] = 3.14;
> 
> The following also worked, if I remember right:
> myfoo.fields = Tuple!(42, 25, 3.14, true);
> 
> -- Chris Nicholson-Sauls


More information about the Digitalmars-d-learn mailing list