hash
namespace opentl {
template <typename T>
struct hash;
}
A hash functor used to generate hash codes.
Specializations
hash<bool>hash<char>hash<signed char>hash<unsigned char>hash<wchar_t>hash<char8_t>hash<char16_t>hash<char32_t>hash<short>hash<unsigned short>hash<int>hash<unsigned int>hash<long>hash<unsigned long>hash<long long>hash<unsigned long long>hash<T*>hash<opentl::nullptr_t>
Member Function
| Name | Return Type | Description |
|---|---|---|
operator()(T value) |
opentl::size_t |
Computes the hash of the value. |
Example
#include <hash.hpp>
int main() {
auto i = opentl::hash<int>{}(123);
int x = 7;
auto p = opentl::hash<int*>{}(&x);
auto n = opentl::hash<opentl::nullptr_t>{}(nullptr);
return static_cast<int>(i ^ p ^ n);
}