Awesome... it works!
-Eric
-------- Original Message --------
Subject: Re: enum question
From: Ali Çehreli <[email protected]>
Date: Tue, March 18, 2014 3:51 pm
To: [email protected]
On 03/18/2014 01:40 PM, Eric wrote:
> Apparently you can't pass an enum as a reference,
It is possible as seen in the following code.
> I have read on this forum that someday enums may be able to be
> made with class elements.
Someday is today! :)
class C
{
int i;
this(int i)
{
this.i = i;
}
}
enum E : C
{
_one_ = new C(1),
two = new C(2)
}
void foo(ref E e)
{
e = E.two;
}
void main()
{
auto e = E.one;
foo(e);
assert(e == E.two);
}
Ali
