staticPredSwitch

Returns one of a collection of expressions based on the value of the switch expression.

template staticPredSwitch(T...)
pure nothrow
staticPredSwitch
(
E
)

Members

Functions

staticPredSwitch
auto staticPredSwitch(E switchExpression)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

alias numberName = staticPredSwitch!(
    1, "one",
    2, "two",
    3, "three",
    "many",
);

static assert("one" == numberName(1));
static assert("two" == numberName(2));
static assert("three" == numberName(3));
static assert("many" == numberName(4));

Meta