staticPredSwitch

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

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

Examples

1 alias numberName = staticPredSwitch!(
2     1, "one",
3     2, "two",
4     3, "three",
5     "many",
6 );
7 
8 static assert("one" == numberName(1));
9 static assert("two" == numberName(2));
10 static assert("three" == numberName(3));
11 static assert("many" == numberName(4));

Meta