isEnum

Aliases itself to whether or not a symbol is of a type is an enum.

For use with std.meta.Filter, std.traits.allSatisfy and similar, which cannot take is() expressions.

  1. template isEnum(T)
  2. template isEnum(alias T)
    template isEnum () if (
    !isType!T
    ) {
    enum isEnum;
    }

Examples

enum E { a, b, c}

int i;
char c;
size_t s_t;
string s;
int[] arr;

static assert(!isEnum!i);
static assert(!isEnum!c);
static assert(!isEnum!s_t);
static assert(!isEnum!s);
static assert(!isEnum!arr);
static assert( isEnum!(E.a));
static assert( isEnum!(E.c));