running through the following function using gdb in vscode tells me that the deduced argTypes for a function of the form T (*)(const int &, const int *, int &, int)
are int
const int *
int &
and int
respectively. Is there any way to force the compiler to deduce const Type &
when presented with a const Type &
argument? Or is there some other means by which I can extract that type information in a useful way?
#include<typeinfo>
template<typename T, typename...argTypes>
void testfunc(T (*f)(argTypes...))
{
const char *a[] = { typeid(argTypes).name()... };
for(auto &av :a)
{
std::cout << av << std::endl;
}
}
Aucun commentaire:
Enregistrer un commentaire