Function signature testing with is expression.

Ali Çehreli acehreli at yahoo.com
Sun Dec 17 16:05:03 UTC 2017


On 12/17/2017 06:44 AM, Alexandru Ermicioi wrote:

 > It is interesting that it will not work with global functions as well:
 >
 > --------
 > void foo(int i, double d) {};
 > enum bool check = is(typeof(foo) == void function(int, double));
 > --------

There, the address-of operator is missing. This works:

void foo(int i, double d) {};
static assert(is(typeof(&foo) == void function(int, double)));

Ali



More information about the Digitalmars-d-learn mailing list