On Sunday, 16 October 2016 at 13:58:51 UTC, Andrei Alexandrescu wrote:
I was thinking it would be handy if tuples had a way to access a field by name at runtime. E.g.:

Tuple!(int, "a", double, "b") t;
string x = condition ? "a" : "b";
double v = t.get!string(x, 3.14);


That would mean that tuple then needs to keep the strings around - taking up space. That plus the fact that the following code is equivalent (obviously):

Tuple!(int, "a", double, "b") t;
double v = condition ? t.a : t.b;

Why this addition? What does it enable?

Reply via email to