<div class="gmail_quote"><div>Hello Steve</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"></div>
There is a way, as I hinted :)<br>
<br>
I'll show you how, but be prepared to deal with ugliness!<br></blockquote><div><br></div><div>All this smart code would be hidden from the end-users so I really do not care.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


typeof(&F.init.foo) dg; // alternately: void delegate() dg;<br>
dg.funcptr = &F.foo;    // use the type, not the instance, to get the function pointer itself instead of a delegate<br>
dg.ptr = cast(void *)f; // set f is the context pointer<br>
<br>
dg(); // now should call f.foo<br>
<br></blockquote><div>Let me understand this. Is F here an alias for foo? If so why I need to mention stuff like &F.foo? It would defeat my purpose if I have to mention foo by name. But the code you have put here does give me hope. Just that I am not able to grasp what F and foo represent here. Probably you mean F is the type of the class that instantiates the template and foo is the alias for the method I want to call. Am I right?</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Note that this is *not* a virtual call.  That is currently impossible to do without using a lambda.<br></blockquote><div><br></div><div>For my purpose that is perfectly fine for now.</div><div> </div><div>Thanks for throwing light on delegates. You have shown me hope :)</div>

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