Sometimes, we want to print the name of the type of a variable for debugging purpose or some other reasons. Mordern C++ has provide us an API called typeid to get the std::type_info object representing the type, where type_info::name returns full type names. Unfortunately, such names are usually not human-readable. To make them human-readable, we need demangle them. Here is an example of using abi::__cxa_demangle to get human-readable type names. If folly is avaialble on your system, you can use folly::demangle to do this, which is a wrapper of abi::__cxa_demangle helping you deal with the memeory deallocation issue.
#include <iostream>
#include <cxxabi.h>
struct empty { };
template <typename T, int N>
struct bar { };