Memoizing a templated function

Andrej Mitrovic andrej.mitrovich at gmail.com
Mon Apr 16 17:38:41 PDT 2012


On 4/17/12, ixid <nuaccount at gmail.com> wrote:
> Memoizing a templated version of a function doesn't seem to work,
> how would I do it properly?

Instantiate the template first. Either:

n = memoize!(test2!int)(n);

or:

alias test2!int itest;
n = memoize!itest(n);

Actually I'm a little surprised this doesn't work:
memoize!(test2(1));

Seems like IFTI should come into play here but doesn't for some
reason.. anyone else's thoughts?


More information about the Digitalmars-d-learn mailing list