On Monday, 31 August 2020 at 20:39:10 UTC, Andrey Zherikov wrote:
How can I do that?

You can use a normal string[] BUT it is only allowed to be modified inside its own function.

Then you assign that function to an enum or whatever.


string[] ctGenerate() {
   string[] list;
   list ~= "stuff";
   return list;
}

enum list = ctGenerate();


That's all allowed. But CTFE is now allowed to read or modify anything outside its own function; you can't have two separate function calls build up a shared list (unless you can somehow call them both together like `enum list = ctGenerate() ~ other_thing();`

Reply via email to