Example
template summ(T...) { enum summ = T[0] + T[1]; } static assert(staticFold!(summ, 0, 1, 2, 3, 4) == 10); template preferString(T...) { static if(is(T[0] == string)) alias preferString = T[0]; else alias preferString = T[1]; } static assert(is(staticFold!(preferString, void, int, string, bool) == string)); static assert(is(staticFold!(preferString, void, int, double, bool) == bool));
Static version of std.algorithm.reduce (or fold). Expects that F takes accumulator as first argument and a value as second argument.
First value of T have to be a initial value of accumulator.