alias void function(ref int) funcType;

void foo(ref int a) { a--; }

struct functor(A...) {
  A[0] func;
}
void main()
{
  functor!funcType f;
  f.func = &foo;
}

I think the best way is using @property.

alias void function(ref int) funcType;
void foo(ref int a) { a--; }

struct functor(A...) {
  @property void func(A fp) { m_func = fp; }
  A m_func;
}
void main()
{
  functor!funcType f;
  f.func = &foo;
}

Reply via email to