Hello Steve, thanks for looking at this.
I see the code works when I create the delegate first and then send it to
template. That is the way you do it here.
> void main() {
> Foo f = new Foo();
> auto dg = &f.foo; // need to make a symbol so it can be aliased
> callfoo!(dg)();
> }
>
>
But it does not work when I put &f.foo directly as the template argument.
But it works when I say:
void main() {
Foo f = new Foo();
callfoo!(() {f.foo();})(f);
}
But that still does not solve my problem. In my real code, I want to send
the delegate to a template class. And I am supposed to do that as a member
of another class. So the code looks something like:
Class Bar(alias F) {
// Call F in some function here
}
Class Foo {
void foo();
Bar!(() {foo();}) bar;
}
Again this does not work. Maybe I am expecting too much from D. :-) I am
somewhat aware of the issues involved here. I have seen some earlier D
threads.
But then I thought there might be a way to pass the method function literal
(foo) and separately the this pointer of Foo object and then combine the
two at the other end (inside Bar).
Regards
- Puneet