Convert delegate or function type to other.
Jacob Carlborg via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jul 18 23:20:48 PDT 2016
On 2016-07-18 21:19, Rufus Smith wrote:
> No, that converts an actual function. I need to create a new alias from
> the old one.
You mean the actual type? John's answer will give you that.
> I'd also like to be able to create a delegate with a different context
> pointer.
You can explicitly set the context pointer using the "ptr" property:
class Foo
{
void bar() {}
}
void delegate() dg;
dg.ptr = cast(void*) new Foo;
dg.funcptr = &Foo.bar; // not sure if this requires a cast
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list