This function returns a hashcode on contents of the box. This is useful if boxes are to be used as key-values of containers like std::unordered_map
or HashTable.
Its default implementation creates a hash code using the raw placeholder values and in case of array types over the array memory used.
A templated version that compares the first N-bytes is given with UsePlaceholderBytes. Because the number of bytes to use are given with the template parameter, the method compiles to shortest code. It is registered with all fundamental types.
std::hash
, std::equal_to
and std::less
for use with containers of the C++ standard library.Definition at line 74 of file functions.inl.
Public Type Index: | |
using | Signature = size_t (*) ( const Box& self ) |
Public Static Method Index: | |
template<size_t N> | |
static size_t | UsePlaceholderBytes (const Box &self) |
Signature of the invokable function.
self | The box that the hash code is to be calculated for. |
Definition at line 80 of file functions.inl.
|
static |
Templated hash function usable with types boxed as values. For pointer types, a custom variant that collects type-specific hashable data is recommended.
N | The number of bytes to check. |
self | The box to calculate a hash code for. |
Definition at line 75 of file functiondefs.inl.