AMDG On 11/07/2018 01:18 PM, Hans Dembinski via Boost wrote:
I am trying to figure out how to solve an introspection problem since a few days, and I am not making progress. I could use some help, it is for boost.histogram. Maybe what I want is not possible...
I don't know what you need this for, but I would recommend reconsidering why you need this in the first place.
Here is my problem. I have some classes A, B, ... which have some overloaded methods, let's call them `foo`.
struct A { void foo(int, char); void foo(bool, int, char); };
struct B { void foo(double); void foo(bool, double); };
I need a way to detect how many arguments the shorter methods has. If the shorter method is foo(Ts...), the longer method is always (bool, Ts...). This is guaranteed. I do not know what Ts... is, it can be anything.
What if Ts... has a bool as the first item?
I cannot use boost::callable_traits, because an overloaded member function cannot be fetched by name
using t = boost::callable_traits::args_t
; // fails, overload is ambiguous Can't I match the member function with a template of the form something(bool, Ts...) somehow?
Like this?
template