callMemberFunctionWithParamsStruct

ReturnType!(__traits(getMember, o, f))
callMemberFunctionWithParamsStruct
(
string f
S
)
(
S s
)

Examples

Consider:

struct Test {
    float f(int a, float b) {
        return a + b;
    }
}
Test t;

Then it can be called like callMemberFunctionWithParamsStruct!(t, "f")(combined) (see callFunctionWithParamsStruct for the meaning of this).

It is very unnatural to call member f by string name, but I have not found a better solution.

Another variant would be to use callFunctionWithParamsStruct!((int a, float b) => t.f(a, b))(combined), but this way is inconvenient as it requires specifying arguments explicitly.

Meta