Delegate

The delegate union is a conveniant way to setup non gc delegates that are compatible with D delegates.

union Delegate (
FT
) if (
is(PointerTarget!FT == function)
) {
enum type;
}

Alias This

members

Members

Functions

opCall
auto opCall(A a)

Helper to call the delegate without accessing dg.

Structs

DgMembers
struct DgMembers

Defines the delegate layout as defined in the D ABI

Variables

dg
T dg;

Allows to use this union as a true D delegate.

members
DgMembers members;

/ The delegates members;

Examples

struct Foo
{
    bool fun(){return true;}
}
Foo foo;
Delegate!(typeof(&Foo.fun)) atFun;
atFun.ptr = &foo,
atFun.funcptr = &Foo.fun,
assert(atFun());

Meta