mardi 22 août 2017

How do I get the name of the type currently held by an `any`?

Suppose I have either:

  1. A boost::any or
  2. An std::any (and I'm using C++17)

the type of which I don't know. Is it possible for me to print, or get as a string, the name of the type that's being held by the any?

Note: Even a mangled type name - the kind you get with typeid(TR).name() - would be sufficient I can take it from there using abi::__cxa_demangle.





Aucun commentaire:

Enregistrer un commentaire