I have a system that saves typeid.name() data in a vector from various class instances,
and another system that creates bitset signatures for required combinations of classes. This signature system has no need to any class instances passed in.
I know how to get typeid.name() from non-variadic template
template<class T>
const char* getTypeName() const
{
return typeid(T).name();
}
And I figured how to get typeid.name() from variadic template with args
template<class... T>
void getTypeNames(T... args)
{
std::vector<const char*> typeNames;
(typeNames.push_back(typeid(std::forward<T>(args) ).name()), ... );
return typeNames;
}
But what I would really like to do is something like this:
template<class... T>
void getTypeNames()
{
std::vector<const char*> typeNames;
(typeNames.push_back(typeid(std::forward<T>()).name()), ... );
return typeNames;
}
So is it possible to get typeid like this or do I need to find another way?
PS. first time posting to stackoverflow so sorry if question is too vague or not clear enough.
question from:
https://stackoverflow.com/questions/65843593/can-i-get-typeid-from-variadic-template-types-without-passing-args 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…