if static member then call

Engine Machine via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 13 11:34:43 PDT 2016


auto ref foo(T, Args...)(args)
{
     static if (hasStaticMember!(T, "foo"))
         return T.foo!(T)(args);
}

Basically I want to forward the *static* call to T if possible(if 
foo exists in T). The main problem is actually calling T.foo as 
the syntax here doesn't work. I also need to be able to check to 
see if a method is static, since I have no object.




More information about the Digitalmars-d-learn mailing list