isFunctionPointer

Function pointer is a pointer to a function. So a simple function is not a function pointer, but getting the address of such function returns a function pointer.

A function pointer doesn't save the context pointer, thus cannot have access to its outer scope.

Members

Variables

isFunctionPointer
enum bool isFunctionPointer;
Undocumented in source.
isFunctionPointer
enum bool isFunctionPointer;
Undocumented in source.

Parameters

F

A symbol.

Return Value

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

Examples

static assert(isFunctionPointer!(void function()));
static assert(!isFunctionPointer!(void delegate()));

static assert(isFunctionPointer!(() {}));

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

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

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

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

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

See Also

Meta