isFunction

$(D_PSYMBOL isFunction) returns $(D_KEYWORD true) only for plain functions, not function pointers or delegates. Use $(D_PSYMBOL isFunctionPointer) or $(D_PSYMBOL isDelegate) to detect them or $(D_PSYMBOL isSomeFunction) for detecting a function of any type.

Members

Variables

isFunction
enum bool isFunction;
Undocumented in source.
isFunction
enum bool isFunction;
Undocumented in source.

Parameters

F

A symbol.

Return Value

$(D_KEYWORD true) if F is a function, $(D_KEYWORD false) otherwise.

Examples

static assert(!isFunction!(void function()));
static assert(!isFunction!(() {}));
static assert(!isFunction!(void delegate()));

void func()
{
}
static void staticFunc()
{
}
interface I
{
    @property int prop();
}

static assert(isFunction!func);
static assert(isFunction!staticFunc);

auto functionPointer = &staticFunc;
auto dg = &func;

static assert(!isFunction!functionPointer);
static assert(!isFunction!dg);

static assert(isFunction!(I.prop));

See Also

Meta