Structs and CTFE
Simen kjaeraas
simen.kjaras at gmail.com
Sun Jul 4 01:34:58 PDT 2010
Jonathan M Davis <jmdavisprog at gmail.com> wrote:
> Is it not presently possible to use structs for enums
I believe this is the case, yes.
There are ways to do things that are similar, of course:
struct E { //Namespace, as D lacks those
struct S {
this( string phrase, int num ) {
this.phrase = phrase;
this.num = num;
}
string phrase;
int num;
}
enum a = S("hello", 1);
enum b = S("goodbye", 45);
enum c = S("world", 22);
}
--
Simen
More information about the Digitalmars-d-learn
mailing list