makeEnumFromSymbolNames

template makeEnumFromSymbolNames (
string prefix = `__`
string suffix = ``
bool firstUndefined = true
bool useMangleOf = false
Es...
) if (
Es.length != 0
) {}

Members

Manifest constants

members
enum members;
Undocumented in source.

Return Value

a string containing the definition of an enum named name and with enumerator names given by Es, optionally prepended with prefix and appended with suffix.

TODO: Move to Phobos std.typecons

Examples

import std.meta : AliasSeq;
struct E(T) { T x; }
alias Types = AliasSeq!(byte, short, int*, E!int*);
alias Type = makeEnumFromSymbolNames!(`_`, `_`, true, false, Types);
static assert(is(Type == enum));
static assert(Type.undefined.stringof == `undefined`);
static assert(Type._byte_.stringof == `_byte_`);
static assert(Type._short_.stringof == `_short_`);
static assert(Type._intPtr_.stringof == `_intPtr_`);
static assert(Type._EPtr_.stringof == `_EPtr_`);
import std.meta : AliasSeq;

struct E(T) { T x; }

alias Types = AliasSeq!(byte, short, int*, E!int*);
alias Type = makeEnumFromSymbolNames!(`_`, `_`, true, true, Types);

static assert(is(Type == enum));

static assert(Type.undefined.stringof == `undefined`);
static assert(Type._g_.stringof == `_g_`);
static assert(Type._s_.stringof == `_s_`);
static assert(Type._Pi_.stringof == `_Pi_`);

Meta