name of class
variadic list of one or more SmartEnumValues
Generates output of the form:
class EnumName : ISmartEnum { // class contents (see templates above) }
alias SmartEnumValue!(int) Code; mixin (SmartEnum!("Commands", Code("first", 1), Code("second", 2) )); test!("==")(*Commands.description(Commands.first), "first"[]); test!("==")(*Commands.description(1), "first"[]); test!("==")(*Commands.code("first"), Commands.first); test!("==")(*Commands.code("second"), 2); test((1 in Commands) !is null); test((Commands.second in Commands) !is null); test((5 in Commands) is null); test(("first" in Commands) !is null); test(("third" in Commands) is null); size_t count; foreach ( code, descr; Commands ) ++count; test!("==")(count, 2);
Template to mixin a SmartEnum class.