if I have a member function alias and corresponding object and arguments, is there any way to turn them into a member function call?

e.g.

class X{
 void a();
}

auto profit(alias fn, T, Args...)(T t, Args args) {
  ???
}

profit!(X.fn, X)(x);

Constraints are:

1) must conserve ability to omit default arguments
2) if x is a subclass of X which overrides a, must not call overriden a.

I have mutually exclusive solutions for (1) and (2).

.. wait, nevermind. I can probably just wrap the two. It's an interesting problem, though, so I guess I'll post it.

For 1) just parse out the parameter list from typeof(&fn).stringof and mix it in as profit's arg list, and then just mixin x.a(paramids), but that won't counter D's virtual functions

For 2) hack together a delegate
dg.ptr = x;
dg.func_ptr = &fn;

but delegates don't support default arguments.

Reply via email to