isSomeFunction

Detect whether symbol or type T is a function, a function pointer or a delegate.

enum bool isSomeFunction(alias T);

Return Value

A bool

Examples

static real func(ref int) { return 0; }
static void prop() @property { }
class C
{
    real method(ref int) { return 0; }
    real prop() @property { return 0; }
}
auto c = new C;
auto fp = &func;
auto dg = &c.method;

static assert( isSomeFunction!func);
static assert( isSomeFunction!prop);
static assert( isSomeFunction!(C.method));
static assert( isSomeFunction!(C.prop));
static assert( isSomeFunction!(c.prop));
static assert( isSomeFunction!fp);
static assert( isSomeFunction!dg);

real val;
static assert(!isSomeFunction!int);
static assert(!isSomeFunction!val);

Meta