Skip to content

Instantly share code, notes, and snippets.

@MasazI
Created May 25, 2015 10:54
Show Gist options
  • Select an option

  • Save MasazI/f64f9052e9405ae0ba97 to your computer and use it in GitHub Desktop.

Select an option

Save MasazI/f64f9052e9405ae0ba97 to your computer and use it in GitHub Desktop.
typeid.cpp
//
// typeinfo.cpp
// CplusplusPractice
//
// Created by masai on 2015/05/25.
// Copyright (c) 2015年 masai. All rights reserved.
//
#include <iostream>
#include <typeinfo>
#include <string>
#include <cxxabi.h>
using namespace std;
template<typename T>
void func(T t){
cout << abi::__cxa_demangle(typeid(t).name(), 0, 0, 0) << endl;
}
int main(int argc, char* argv[]){
func<int>(12);
func<double>(12.0);
func<string>("abc");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment