Created
September 11, 2012 22:24
-
-
Save satoruhiga/3702587 to your computer and use it in GitHub Desktop.
Type2Int
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
template<typename T> | |
struct Type2Int | |
{ | |
static unsigned int value() | |
{ | |
static size_t m = 0; | |
return (unsigned int)&m; | |
} | |
}; | |
int main() | |
{ | |
assert(Type2Int<int>::value() == Type2Int<int>::value()); | |
assert(Type2Int<int>::value() != Type2Int<unsigned int>::value()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment