Generating an enum from a tuple of Types?

2014-01-25 Thread Johannes Pfau
Is it possible to generate a enum from a tuple of types without string mixins? struct S(Types...) { enum Tag { //? } } where the tag enum should have Types.length members. The exact names of the enum members don't matter and could be numbered, for exam

Re: Generating an enum from a tuple of Types?

2014-01-25 Thread Stanislav Blinov
On Saturday, 25 January 2014 at 15:38:39 UTC, Johannes Pfau wrote: Is it possible to generate a enum from a tuple of types without string mixins? struct S(Types...) { enum Tag { //? } } Without mixins altogether... dunno. But nothing stops you fr

Re: Generating an enum from a tuple of Types?

2014-01-25 Thread Dicebot
If one wants to generate code with new identifiers, usage of string mixins is pretty much unavoidable.

Re: Generating an enum from a tuple of Types?

2014-01-25 Thread Artur Skawina
On 01/25/14 16:38, Johannes Pfau wrote: > Is it possible to generate a enum from a tuple of types without string > mixins? > > struct S(Types...) > { > enum Tag > { > //? > } > } > > > where the tag enum should have Types.length members. The exact name

Re: Generating an enum from a tuple of Types?

2014-01-25 Thread Johannes Pfau
Am Sat, 25 Jan 2014 18:55:54 +0100 schrieb Artur Skawina : > > Well, if you don't need names then just use the index directly. > > Eg, see 'DiscUnion.type' in > > http://forum.dlang.org/thread/mtkzbwfgwsstndxbe...@forum.dlang.org#post-mailman.555.1377703234.1719.digitalmars-d-learn:40puremagic