isDelegate

Detect whether symbol or type T is a delegate.

template isDelegate (
T...
) if (
T.length == 1
) {
enum bool isDelegate;
enum bool isDelegate;
enum bool isDelegate;
}

Examples

static void sfunc() { }
int x;
void func() { x++; }

int delegate() dg;
assert(isDelegate!dg);
assert(isDelegate!(int delegate()));
assert(isDelegate!(typeof(&func)));

int function() fp;
assert(!isDelegate!fp);
assert(!isDelegate!(int function()));
assert(!isDelegate!(typeof(&sfunc)));

Meta

Suggestion Box / Bug Report