byKeyValue is not available at compilation-time right ?

Adam D Ruppe destructionator at gmail.com
Sun Jul 25 17:45:18 UTC 2021


On Sunday, 25 July 2021 at 17:29:46 UTC, someone wrote:
> What is the proper syntax to use manifest-constants with 
> associative arrays then ? The one you showed me ?

You have the right syntax for that. What I'm saying is you might 
not need the associative array at all. Why do you want to use 
that specifically?

> You say a normal foreach ... to be used at compilation-time ... 
> huh ?

Normal foreach is evaluated at compile time if it is looping over 
an aliasseq tuple or if it is run in a compile time context.

Part of the magic of D is ordinary code might be compile time or 
run time depending on how you use it.

But even static foreach I think can do the

static foreach(k, v; your_assoc_array) {}

in some cases.



More information about the Digitalmars-d-learn mailing list