Map

Map takes a template and applies it to every element in the given AliasSeq, resulting in an AliasSeq with the transformed elements.

So, it's equivalent to AliasSeq!(Fun!(Args[0]), Fun!(Args[1]), ..., Fun!(Args[$ - 1])).

template Map (
alias Fun
Args...
) {}

Examples

import phobos.sys.traits : Unqualified;

// empty
alias Empty = Map!Unqualified;
static assert(Empty.length == 0);

// single
alias Single = Map!(Unqualified, const int);
static assert(is(Single == AliasSeq!int));

// several
alias Several = Map!(Unqualified, int, const int, immutable int, uint,
                     ubyte, byte, short, ushort, const long);
static assert(is(Several == AliasSeq!(int, int, int, uint,
                                      ubyte, byte, short, ushort, long)));

alias ToDynamicArray(T) = T[];

alias Arrays = Map!(ToDynamicArray, int, const ubyte, string);
static assert(is(Arrays == AliasSeq!(int[], const(ubyte)[], string[])));

Meta