Compile time data structure
Ali Çehreli
acehreli at yahoo.com
Thu Sep 19 13:52:55 PDT 2013
On 09/19/2013 12:12 PM, Marek Janukowicz wrote:
> (why is your book not linked on dlang.org?
It will appear there once the translation is complete.
> how do I create a tuple at compile time if I'm getting
> information I want to put into it in a foreach? All the
> examples I found create a tuple with all it's attributes
> available, while I get mine in an iterative manner...
I think the automatic expansion of a TypeTuple as parameter list may be
used in a some sort of recursive templates:
import std.typetuple;
void main()
{
alias t0 = TypeTuple!(1, "hello");
alias t1 = TypeTuple!(t0, 2.3); // Adds to t0
pragma(msg, t1); // prints tuple(1, "hello", 2.3)
}
Ali
More information about the Digitalmars-d-learn
mailing list