Any workaround for "closures are not yet supported in CTFE"?

Andrey Zherikov andrey.zherikov at
Wed Dec 8 02:05:22 UTC 2021

On Tuesday, 7 December 2021 at 18:50:04 UTC, Ali Çehreli wrote:
> I don't know whether the workaround works with your program but 
> that delegate is the equivalent of the following struct (the 
> struct should be faster because there is no dynamic context 
> allocation). Note the type of 'dg' is changed accordingly:

The problem with struct-based solution is that I will likely be 
stuck with only one implementation of delegate (i.e. opCall 
implementation). Or I'll have to implement dispatching inside 
opCall based on some "enum" by myself which seems weird to me. Do 
I miss anything?

More information about the Digitalmars-d-learn mailing list