Can I use memoize with a non-static struct method?

Marc jckj33 at gmail.com
Tue Dec 26 00:47:14 UTC 2017


something like this:

> struct S {
>   // variables...
>   string doGen(int n) { return ""; }
>   alias gen = memoize!doGen;
> }

The error I got is:

> Error: need 'this' for 'doGen' of type 'string(int n)'

I can't make doGen static because it access non-static struct 
members... can I workaround this?


More information about the Digitalmars-d-learn mailing list