Created
May 25, 2015 10:54
-
-
Save MasazI/f64f9052e9405ae0ba97 to your computer and use it in GitHub Desktop.
typeid.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // 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