New hash
Andrej Mitrovic
andrej.mitrovich at gmail.com
Fri Mar 23 21:12:00 PDT 2012
On 3/24/12, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:
> Fix pushed to github. :-)
Okay. Then I have some eye-candy for you:
template Assoc(T)
if (std.traits.isAssociativeArray!T)
{
alias AA!(GetTypesTuple!T) Assoc;
}
import std.typetuple;
template GetTypesTuple(T)
if (std.traits.isAssociativeArray!T)
{
static if (std.traits.isAssociativeArray!(ValueType!T))
{
alias TypeTuple!(KeyType!T, AA!(GetTypesTuple!(ValueType!T)))
GetTypesTuple;
}
else
{
alias TypeTuple!(KeyType!T, ValueType!T) GetTypesTuple;
}
}
With this, you can now use this syntax:
Assoc!(int[string]) aasi;
Assoc!(dstring[int]) aaid;
I think this can make testing easier.
More information about the Digitalmars-d
mailing list