Named tuple from struct

Guilherme Vieira n2.nitrogen at gmail.com
Sat Jan 8 00:15:02 PST 2011


Is is possible to get a named tuple from a struct type?

E.g.:

struct S { int foo; string bar; }

S s;

S.tupleof t; // S.tupleof is a tuple type, as opposed to s.tupleof,
             // which yields a tuple instance

t[0] = 1;
t.bar = "2";


If not, I think it would be quite useful.

Even still, a way to describe tuple types as if it was a struct would also
be useful:

tuple StructLike
{
    int foo;
    string bar;
}

StructLike t;

t[0] = 1;
t.bar = "2";


-- 
Atenciosamente / Sincerely,
Guilherme ("n2liquid") Vieira
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20110108/97bd3cfc/attachment.html>


More information about the Digitalmars-d-learn mailing list