CTFE, string mixins & code generation

Jacob Carlborg doob at me.com
Fri Jan 24 19:26:50 UTC 2020


On 2020-01-24 19:43, H. S. Teoh wrote:

> (enums cannot take AA's or
> class objects as values, also, once assigned they are immutable).

AA enums work. Class objects kind of work. One can use static 
const/immutable instead. The following snippet compiles:

class A
{
     int a = 3;
}

const bar = new A;
enum a = bar.a;

enum foo = [1:2];

void main()
{
}

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list