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)
) {}

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

1 struct Foo
2 {
3     bool fun(){return true;}
4 }
5 Foo foo;
6 Delegate!(typeof(&Foo.fun)) atFun;
7 atFun.ptr = &foo,
8 atFun.funcptr = &Foo.fun,
9 assert(atFun());

Meta