tupleof feature request
Jarrett Billingsley
kb3ctd2 at yahoo.com
Fri Sep 21 15:35:58 PDT 2007
"bc" <mi_emayl_adrez at hotmail.com> wrote in message
news:op.ty0sldi3u40fk4 at hal9000...
------------------------------------------
i was thinking, it would be nice if you could do some of these things:
import std.stdio;
template Tuple(E...)
{
alias E Tuple;
}
alias Tuple!(int, int) TL;
void main()
{
TL tl;
struct S
{
int x;
int y;
}
S s;
s.x = 1;
s.y = 2;
tl = s.tupleof;
auto tl2 = s.tupleof;
writefln(tl2);
tl2 = s.tupleof; // doesn't compile
s.tupleof = tl2; // doesn't compile
}
------------------------------------------
Don Clugston and I (and probably others ;) ) have suggested some kind of
unification of tuples and structs before. You could do some cool stuff.
More information about the Digitalmars-d
mailing list