<div class="gmail_quote"><div>Hello Steve, thanks for looking at this.</div><div><br></div><div>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.</div><div>

 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
void main() {<br>
  Foo f = new Foo();<br></div>
  auto dg = &f.foo; // need to make a symbol so it can be aliased<br>
  callfoo!(dg)();<br>
}<br><br></blockquote><div><br></div><div>But it does not work when I put &f.foo directly as the template argument. But it works when I say:</div><div><br></div><div>void main() {</div><div><div>  Foo f = new Foo();</div>

<div>  callfoo!(() {f.foo();})(f);</div><div>}</div><div><br></div></div><div>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:</div>

<div><br></div><div>Class Bar(alias F) {</div><div> // Call F in some function here</div><div>}</div><div><br></div><div>Class Foo {</div><div>  void foo();</div><div>  Bar!(() {foo();}) bar;</div><div>}</div><div><br></div>

<div>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.</div><div><br></div><div>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).</div>

<div><br></div><div>Regards</div><div>- Puneet</div><div><br></div></div>