std::vector<std::type_index> vec;
template <typename T1, typename... Tn>
void Fill() {
vec.push_back(typeid(T1));
// fill the vector with the remaining type ids
}
I want to fill the vector with the typeid
s of the template arguments. How could I implement this?
The following solution uses intializer list:
template <typename... Types>
void Fill(std::vector<std::type_index>& vec)
{
vec.insert(vec.end(), {typeid(Types)...});
}
See live example.