import std.meta : AliasSeq; enum mulBy2(alias x) = x * 2; enum add(alias a, alias b) = a + b; static assert(staticMapReduce!(mulBy2, add, AliasSeq!(1)) == 2); static assert(staticMapReduce!(mulBy2, add, AliasSeq!(1, 2)) == 6); static assert(staticMapReduce!(mulBy2, add, AliasSeq!(1, 2, 3, 4, 5)) == 30);
Applies map to each element of a compile-time sequence and then recursively calls reduce on each pair.