I am newly studying auto feature of C++11/14.
For educational purpose, I would like to explicitly display the result of type inference of my code. I tried typeid().name(), but I found two problems with this approach.
- Output is sometimes difficult to understand. (For example, "NSt3__16vectorIiNS_9allocatorIiEEEE")
- const/volatile modifiers do not seem to be displayed.
@πάνταῥεῖ I have tried using abi::__cxa_demangle() you pointed out.
Problem 1 is solved, thank you, but typeid().name() does not seem to contain CV modifier information.
I think there are some pitfalls using auto
keyword, so I would like to see the exact result of the type inference, including CV modifier and reference type.
I am using clang 6.1.0 on mac os 10.10.3, but I would like to know portable way to do this, if possible.