how do I get the ith field of a std.typecons.Tuple ?
Timothee Cour
thelastmammoth at gmail.com
Sun Aug 18 01:46:03 PDT 2013
A)
how do I get the ith field of a std.typecons.Tuple ?
ideally, it should be as simple as:
auto t=Tuple!(int,"name",double,"name2")(1);
static assert(t.fields[0] == "name");
It seems the necessary items are private, so how do I get the ith field of
a std.typecons.Tuple ?
I really don't want to parse T.stringof, which could require a full parser
(eg: with Tuple!(A!"bar","name") )
B)
Related question:
Why isn't slicing and indexing allowed for the Tuple type?
eg:
alias T=typeof(t);
static assert(is(T[0] == int));
static assert(is(T[0..1] == Tuple!(int,"name"));
C)
Same with appending:
static assert(is(T[0..1]~T[1..2] == T));
D)
I'm trying to make an append operator but because of problem (A) above I
can't (for named Tuples).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130818/e3550854/attachment.html>
More information about the Digitalmars-d-learn
mailing list