Created
August 4, 2017 09:44
-
-
Save cyrus-and/08c41397c02936b6fceb13c976a74bab to your computer and use it in GitHub Desktop.
C++ debug type prints
This file contains 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
#include <iostream> | |
template <typename T> | |
void print_type_of(T value = T()) { | |
(void)value; | |
std::clog << __PRETTY_FUNCTION__ << std::endl; | |
} | |
int main() | |
{ | |
float x = 3.14; | |
print_type_of(x); | |
print_type_of<std::string>(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment