@trusting generic functions

Era Scarecrow via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 28 05:07:43 PDT 2016


On Saturday, 28 May 2016 at 11:57:09 UTC, Era Scarecrow wrote:
>     auto doSomethingDumb(T)(ref T t) if(isSafe!(T))

  Should also probably test for a function or delegate. So...?


   auto doSomethingDumb(T)(ref T t)
     if(isSafe!T && (isFunctionPointer!T || isDelegate!T)) {
       T* pt = &t;
       return pt.doSomething();
     }


More information about the Digitalmars-d-learn mailing list