Is it possible to deduce the number of constructors a type has during compile time?
#include <iostream>
#include <type_traits>
struct A{
int m_i;
float m_f
//constructor 1
A(int i): m_i(i) {}
//constructor 2
A(float f): m_f(f) {}
};
int main() {
//prints 2
std::cout << number_of_constructors<A>::value << '\n';
}
I was hoping to avoid any macro involvement with the constructors, but perhaps that is the only way.