Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tuple vs TypeTuple in D

Tags:

d

What is the difference between Tuple and TypeTuple? I've looked at sample code in the library, but they look similar. How do I decide which to use? and is there a good reason why Tuple is in std.typecons but TypeTuple is in std.typetuple?

like image 406
Arlen Avatar asked May 19 '11 16:05

Arlen


1 Answers

A Tuple is a data type, consisting of a collection of fields that you specify.

A TypeTuple is simply "a bunch of things" that the compiler knows about at compile time; it has no existence at run time.

(Contrary to its name, a TypeTuple can hold pretty much anything -- not just types!)

like image 148
user541686 Avatar answered Nov 05 '22 19:11

user541686