enum of tuples

Jonathan M Davis jmdavisProg at gmx.com
Wed Sep 26 15:02:38 PDT 2012


On Wednesday, September 26, 2012 23:24:08 bearophile wrote:
> Van de Bugger:
> > Oops. What the problem?
> 
> I seems one or more bugs. D named enums are adapted from the C
> language, they were first of all meant to contain simple values
> like ints or chars. The more complex things you keep trying to
> put in them, the more bugs you will find :-) People in D.learn
> keep trying to put complex things in them, but maybe Walter has
> not even tested them with more complex types, like class
> instances.

Classes will not work for the same reason that you can never use a class 
object as an enum with manifest constants. It's a long-standing bug that 
structs don't work as enums (other than manifest constants) even though 
they're supposed to according to TDPL:

http://d.puremagic.com/issues/show_bug.cgi?id=4423

>From the sounds of it though, if Tuple fixes its signatures for opCmp, it can 
be made to work. Regardless, it should be reported that tuples don't work as 
enums other than manifest constants.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list