staticMapReduce

Applies map to each element of a compile-time sequence and then recursively calls reduce on each pair.

Members

Aliases

staticMapReduce
alias staticMapReduce = map!(Args[0])
Undocumented in source.
staticMapReduce
alias staticMapReduce = reduce!(staticMapReduce!(map, reduce, Args[0]), staticMapReduce!(map, reduce, Args[1..$]))
Undocumented in source.

Examples

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);

Meta