#include <iostream>
#include <typeinfo>
#include <cxxabi.h>

std::string dm(const std::string& name)
{
	int status;
	return std::string(abi::__cxa_demangle(name.c_str(), 0, 0, &status));
}

using namespace std;

template <typename T>
using remove_const_if_pointer_to_const = 
	std::conditional_t<std::is_pointer<T>::value,
		std::add_pointer_t<std::remove_const_t<std::remove_pointer_t<T>>>,
		T>;




int main() {

	using A = int;
	using B = int*;
	using C = const int*;
    
	std::cout << dm(typeid(remove_const_if_pointer_to_const<A>).name()) << std::endl;
	std::cout << dm(typeid(remove_const_if_pointer_to_const<B>).name()) << std::endl;
	std::cout << dm(typeid(remove_const_if_pointer_to_const<C>).name()) << std::endl;
    
	return 0;
}