November 04, 2010
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.

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
Top | Discussion index | About this forum | D home