Get return type statically

Smoke Adams via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 27 18:41:03 PDT 2016


I have a type

public class SuperFunction(T)
{
   T t;
   return(T) Do() { return t(); }
}

where T is a delegate or function. First, I would like to be able 
to specify that this must be the case for SuperFunction so we 
can't pass non-function/delegates for T. Second, How to specify 
the return type of Do to match that of T.

e.g., SuperFunction!(bool function())

then return(T) should be bool.

Similarly, I would like to extra the T's parameters and make Do 
have them also.

This way, SuperFunction!T.Do emulates T in every way.




More information about the Digitalmars-d-learn mailing list