Hi,

I have a class with methods and I want to call a method by using a variant array. The length of the array and the types exactly fits the method signature.

In the last line of main you see the coding which should be generated. I need some coding which looks at the signature of bar and uses this information
to create "(args[0].get!string, args[1].get!long)".

I think it is possible with string mixins, but is there some better way?
Maybe a staticMap?

class Foo
{
    void bar(string s, long l) {}
}

void main()
{
    import std.variant: Variant;

    Foo foo = new Foo();

    Variant[] args = [Variant("Hello"), Variant(42)];
__traits(getMember, foo, "bar")(args[0].get!string, args[1].get!long);
}

Kind regards
André

Reply via email to