How can I print a type list ??
here is what I tried + my type list :
template<typename ...T>
struct typeList;
template<typename H, typename ...T>
struct typeList<H, T...> {
using head = H;
using tail = typeList<T...>;
public:
static inline void print(){
std::cout << H::name << " "; // How can I get the name of H ???
typeList<T...>::print();
}
};
template<>
struct typeList<>{
static inline void print(){
std::cout << endl;
}
};
so that typeList<A,B,C,int>::print() would give A b C int ,
A B and C are some user defined structs
Can I do this without adding a static function called name in every struct??
There is no compile time function that returns the type name ?
EDIT :
This is not a duplicate of this, where did I mention variables ??
type_infoobject is not required to give you a useful name.