Re: Do I need to use static here?

2019-01-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/8/19 1:35 PM, Machine Code wrote: I'm using enum to compute the value at runtime like this: struct A { enum foo = A("foo", 10); enum baa = A("baa", 20); string name; int value; alias value this; } In order to avoid foo having its value (even if literal) copied eve

Do I need to use static here?

2019-01-08 Thread Machine Code via Digitalmars-d-learn
I'm using enum to compute the value at runtime like this: struct A { enum foo = A("foo", 10); enum baa = A("baa", 20); string name; int value; alias value this; } In order to avoid foo having its value (even if literal) copied every time A instancied and