isSafe and overloaded functions

Johannes Pfau spam at example.com
Thu Nov 4 08:20:39 PDT 2010


Hi,
I'm sure there's an easy solution for this problem, but I can't seem to find 
the correct syntax to do this. What I want to do is checking whether a 
specific function overload is safe.

Example
--------------------------------------------
import std.traits;
import std.stdio;

@system void abc(){}
@safe void abc(int a){}

void main() {
    writeln(isSafe!(abc)); // returns false
    writeln(isSafe!(abc(int))); //not working
    writeln(isSafe!(&abc(int))); //not working
    writeln(isSafe!(abc(int.init))); //not working
    writeln(isSafe!(&abc(int.init))); //not working
}

-- 
Johannes Pfau


More information about the Digitalmars-d-learn mailing list