Reputation: 3582
Assume I have a class bar
with multiple implementations of method foo
:
struct bar {
void foo(int, int);
void foo(float, bool);
void foo(const vector<void*>&);
}
Is there a possibility for me to obtain a list of lists of arguments' types? In other words, I define
template<typename... types> class list {};
and want to obtain list<list<int, int>, list<float, bool>, list<const vector<void*>&>>
.
Upvotes: 0
Views: 202
Reputation: 275435
No.
You can ask the question "can I call bar.foo
with args int, long
?". You can ask the question "is there a &Bar::foo
method of type void (Bar::*)(int, int)
?", but neither match your requirements.
Another thing you can do is perfect forward into bar.foo
, and even do SFINAE testing so failure to forward results in a failure at the forwarding interface, not within its implementation.
If you have a finite list of types and max arg count, you can exhastively search the set of overloads for the ones that work, or for exact signature matches, at O(T^N) cost.
As an editorial, your question has the usual flaw with questions of this type, where you describe a particular technical challenge and fail to even casually describe the problem this challenge is intended to solve. It is actually shocking how reliable the "I want to reflect on function signature overload" questions never, ever volunteer what the particular problem their reflection is intended to fix. Many, many such problems have solutions that full reflection is not required to solve.
Upvotes: 2