Created
November 13, 2019 17:35
-
-
Save BillyDonahue/2abb8f1dc495e14cd6bf869304b58578 to your computer and use it in GitHub Desktop.
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 <cstdint> | |
#include <iostream> | |
#include <type_traits> | |
template <typename> const std::string tName{"???"}; | |
template <> const std::string tName<char>{"char"}; | |
template <> const std::string tName<signed char>{"signed char"}; | |
template <> const std::string tName<unsigned char>{"unsigned char"}; | |
template <> const std::string tName<short>{"short"}; | |
template <> const std::string tName<unsigned short>{"unsigned short"}; | |
template <> const std::string tName<int>{"int"}; | |
template <> const std::string tName<unsigned int>{"unsigned int"}; | |
template <> const std::string tName<long>{"long"}; | |
template <> const std::string tName<unsigned long>{"unsigned long"}; | |
template <> const std::string tName<long long>{"long long"}; | |
template <> const std::string tName<unsigned long long>{"unsigned long long"}; | |
int main() { | |
#define PR(t) std::cout << #t " is " << tName<t> << std::endl; | |
PR(int8_t); | |
PR(uint8_t); | |
PR(int16_t); | |
PR(int32_t); | |
PR(int64_t); | |
PR(size_t); | |
PR(ptrdiff_t); | |
PR(intptr_t); | |
PR(uintptr_t); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OSX:
make CXXFLAGS=-std=c++17 types_test ; ./types_test