Skip to content

Instantly share code, notes, and snippets.

@satoruhiga
Created September 11, 2012 22:24
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 satoruhiga/3702587 to your computer and use it in GitHub Desktop.
Save satoruhiga/3702587 to your computer and use it in GitHub Desktop.
Type2Int
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