
Mathias Gaunard wrote :
You could generate nested switches to identify what type std::type_info::name is within a finite set of possibilities. That allows identification to be done in constant-time.
Imagine identifying whether type_info is "a" or "aa" for example. <snip code> If you have the mangled names at compile-time, it is possible to generate that kind of automaton automatically.
Well, I already generate such structure at compile time using type traits based decomposition and tag dispatching. The "runtime" part is just acually feeding all parts of the type name string description (volatile, const, repetition of *, array extent etc) to the ostringstream. I don't think using type_info is a better solution as its output depends on compiler and are sometimes non-existant.