ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
No Matches
FHashcode Struct Reference


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.

Compatibility header alib/compatibility/std_boxing_functional.hpp specializes functors std::hash, std::equal_to and std::less for use with containers of the C++ standard library.
See also
Method Box::Hashcode , which calls this function.

Definition at line 77 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)

Type Definition Details:

◆ Signature

using Signature = size_t (*) ( const Box& self )

Signature of the invokable function.

selfThe box that the hash code is to be calculated for.
The hash code.

Definition at line 85 of file functions.inl.

Method Details:

◆ UsePlaceholderBytes()

template<size_t N>
size_t UsePlaceholderBytes ( const Box & self)

Templated hash function usable with types boxed as values. For pointer types, a custom variant that collects type-specific hashable data is recommended.

Template Parameters
NThe number of bytes to check.
selfThe box to calculate a hash code for.
The hash code.

Definition at line 73 of file functiondefs.inl.

Here is the call graph for this function:

The documentation for this struct was generated from the following files: