D compile time algorithms implementation
khurshid
khurshid.normuradov at gmail.com
Fri Apr 19 23:07:15 PDT 2013
I just have read from github std.variant, std.typetuple, etc.
source codes.
And I have a question.
Why more linear algorithms implemented with O(N^2) ?
example: staticMap, it doesnot compiled more 500 arguments.
although, following version compiled for more than 32768
arguments:
template staticMap2(alias F, T...)
{
static if (T.length == 0)
{
alias TypeTuple!() staticMap2;
}
else static if (T.length == 1)
{
alias TypeTuple!(F!(T[0])) staticMap2;
}
else
{
alias TypeTuple!( staticMap2!(F, T[0..$/2]),
staticMap2!(F,
T[$/2..$])) staticMap2;
}
}
More information about the Digitalmars-d
mailing list