Skip to content

Instantly share code, notes, and snippets.

@likejazz
Created January 14, 2018 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save likejazz/48c907301dfde3c024d699d875d3846c to your computer and use it in GitHub Desktop.
Save likejazz/48c907301dfde3c024d699d875d3846c to your computer and use it in GitHub Desktop.
#include <iostream>
template<class T>
constexpr
std::string_view
type_name() {
using namespace std;
string_view p = __PRETTY_FUNCTION__;
return string_view(p.data() + 34, p.size() - 34 - 1);
}
// --
int main() {
char c = 'a';
std::cout << type_name<decltype(c)>() << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment