Created
December 25, 2016 17:01
-
-
Save zhrkvl/2cefe3cdabc809db59b356058d5b5bfc to your computer and use it in GitHub Desktop.
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> | |
const char32_t * const __get_byte_array(const T& data) | |
{ | |
void * __void_ptr = (void *) &data; | |
const char32_t * const __char_ptr = (const char32_t * const) __void_ptr; | |
return __char_ptr; | |
} | |
template<typename T> | |
const size_t Hash(const T& data) | |
{ | |
size_t sz = sizeof(T); | |
return hash<u32string>()(u32string(__get_byte_array(data))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment