digitalmars.D.learn - string[] enumerations
- Nrgyzer (17/17) May 10 2011 Hi there,
- Andrej Mitrovic (6/6) May 10 2011 I've ran into the same problem.
- Nrgyzer (2/8) May 11 2011 Works great - thanks!
- Tomek =?UTF-8?B?U293acWEc2tp?= (4/5) May 10 2011 What for?
Hi there, I need enumerations with string[] as base type. It works when I use enum MyEnum : string[] { a = ["a", "b", "c"], } but when I add more types like enum MyEnum : string[] { a = ["a", "b", "c"], b = ["d", "e", "f"], c = ["g", "h", "i"], // ... } I always get the following error(s): Error: Integer constant expression expected instead of ["a", "b", "c"] < ["a", "b", "c"] Is there any solution in D to realize to add more than one string[]- array to an enumeration? Thanks!
May 10 2011
I've ran into the same problem. There's a way to partially simulate an enum with a struct and some typedef magic: http://codepad.org/RNYyyFqc So it kind of acts like an enum. But it's just a workaround, there might be performance issues + switches don't work for structs. It was just an experiment though.
May 10 2011
== Auszug aus Andrej Mitrovic (andrej.mitrovich gmail.com)'s ArtikelI've ran into the same problem. There's a way to partially simulate an enum with a struct and some typedef magic: http://codepad.org/RNYyyFqc So it kind of acts like an enum. But it's just a workaround, there might be performance issues + switches don't work for structs. It was just an experiment though.Works great - thanks!
May 11 2011
Nrgyzer napisa=C5=82:I need enumerations with string[] as base type.What for? --=20 Tomek
May 10 2011