On Thursday, 1 December 2016 at 23:51:19 UTC, Payotz wrote:
So, to give context, I am trying to make an event manager for a
game I'm making.
I was writing the "register()" method so I ran into a problem.
The register method will take in delegates as an argument, but
those delegates have varied arguments themselves, so I can't
really put anything there. I know that it's got something to do
with templates so I tried my hand in it and came up with this:
void registerEvent(string event_name,T...)(T delegate() dg);
May be std.variant will help you.
https://dlang.org/phobos/std_variant.html
You can bring the delegates to a common interface, hiding the
differences in std.variant