Andrey Semashev wrote:
Hi Peter,
I can see you already extracted demangle() to boost/core. Great, thanks!
However I'd prefer it to be detached from type_info. This tool would be useful with different kinds of symbols, like function and variable names, not just type_info. So it better accept a string as an argument and not type_info. demangled_name() should probably be in core/typeinfo.hpp.
'demangle' does accept a string as the argument - it's just in core::detail. demangled_name, which is typeinfo-specific, needs to forego demangling when RTTI is off, because then core::typeinfo returns an already demangled sort-of name using __PRETTY_FUNCTION__. We can lift demangle() to core:: if you like. I wasn't sure about that so I left it in detail.
And regarding typeinfo.hpp. Aren't we duplicating Boost.TypeIndex here?
Maybe. I use typeinfo.hpp in lightweight_test_trait.hpp though, and the less dependencies a test header has, the better, because a compile error in a dependency causes all the tests in the world to fail. Which is undesirable. (That's also why I split the _trait part from lightweight_test.) Plus, typeinfo.hpp was already present, as detail/sp_typeinfo.hpp, I just renamed it.
PS: I was also planning to create pull requests to other libraries to use demangle from Core. These are Exception, Units, TypeIndex and Log, AFAIK. Do you plan to do this? If not, I could.
Do go ahead with these, once we sort out the namespace question.