I have a delegate as a parameter in a function which is a template function.
And I want to use alias for the delegate parameter.
Is there a better way for this?

My demo code:

template AsynchronousAction(T)
{
        alias void delegate(T argument) FuncType;
}

public class TestC
{
        int b = 3;

        //void test(T)(void delegate(T argument) func )
        void test(T)(AsynchronousAction!(T).FuncType func )
        {
                static if(is(T == string))
                func("It's me");
        }

        this(int x)
        {
                b = x;
        }
}

Reply via email to