Re: Constructing an enum using the members of an AliasSeq as enumerator names

2016-04-28 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 27 April 2016 at 15:30:55 UTC, ag0aep6g wrote: That takes longer to compile, though. Probably needs more memory as well. Thanks! Added here https://github.com/nordlow/phobos-next/blob/master/src/typecons_ex.d#L425

Re: Constructing an enum using the members of an AliasSeq as enumerator names

2016-04-27 Thread ag0aep6g via Digitalmars-d-learn
On 27.04.2016 13:06, Nordlöw wrote: /** Returns: 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 */ string

Re: Constructing an enum using the members of an AliasSeq as enumerator names

2016-04-27 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 27 April 2016 at 10:49:54 UTC, Nordlöw wrote: What's the easiest way to create an `enum` using the symbol names of an `AliasSeq` as enumerator names? /** Returns: a `string` containing the definition of an `enum` named `name` and with enumerator names given by `Es`,

Constructing an enum using the members of an AliasSeq as enumerator names

2016-04-27 Thread Nordlöw via Digitalmars-d-learn
What's the easiest way to create an `enum` using the symbol names of an `AliasSeq` as enumerator names? That is, given alias Types = AliasSeq!(byte, short, int); we need some compile-time type-constructor `makeEnum` called as alias E = makeEnum!Types; that should be equivalent to