Passing member-function to template

Zhenya zheny at list.ru
Sat Jan 12 10:17:46 PST 2013


Hi!
Tell me please,is there any way to pass member-function to 
template?
I need something like that:

template execute(alias obj,alias mfun)
{
     void execute()
     {
         obj.mfun();
     }
}

struct Foo
{
    void nothing()
    {
    }
}

void main()
{
     Foo f;
     execute!(f,Foo.nothing)();
}

I could pass mfun by string,but I think it's a little bit ugly.


More information about the Digitalmars-d-learn mailing list