s/type tuple/template pack/g please

Jacob Carlborg doob at me.com
Thu Aug 22 00:42:40 PDT 2013


On 2013-08-22 09:29, Jonathan M Davis wrote:

> Considering that std.typecons.Tuple actually acts like a full-on tuple (it
> actually nests) and the built-in "tuple" doesn't, that would be an odd choice
> IMHO.

I don't know the exact definition of "tuple" but what have nesting to do 
with it?

You can add names to the values using std.typecons.Tuple

alias Tuple!(int, "index", string, "value") Entry;
Entry e;
e.index = 4;
e.value = "Hello";
assert(e[1] == "Hello");
assert(e[0] == 4);

The above is basically exactly like an anonymous struct.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list