Recursive delegate inside template?

Adam D. Ruppe destructionator at gmail.com
Fri Jun 26 15:10:07 UTC 2020


On Friday, 26 June 2020 at 14:12:00 UTC, drathier wrote:
> I'm trying to get this to compile, without much luck:

You might be able to make it a function:


bool foo()
{
     auto fn(A)()
     {
         A delegate(A) fn;
         fn = delegate A(A a)
         {
             return fn(a);
         };
         return fn;
     }

     return fn!(bool)()(true);
}

> but I need the function to be polymorphic, so I need the 
> template.

I don't really understand your need though, can you post more 
context?


More information about the Digitalmars-d-learn mailing list