Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
PairHash Struct Reference

Hash functor for std::pair<int,int>. More...

#include <hash_utils.hpp>

Public Member Functions

std::size_t operator() (const std::pair< int, int > &p) const noexcept
 Computes a hash value for a pair of integers.
 

Detailed Description

Hash functor for std::pair<int,int>.

This functor implements a 64-bit hash combine pattern inspired by Boost's hash_combine. The two integer components are mixed into a single std::size_t value, providing a reasonably well-distributed hash for use in hash-based containers.

Typical usage:

#include <unordered_map>
std::unordered_map<std::pair<int,int>, double, PairHash> cache;
cache[{1,2}] = 3.14;
Hash functor for std::pair<int,int>.

Definition at line 34 of file hash_utils.hpp.

Member Function Documentation

◆ operator()()

std::size_t PairHash::operator() ( const std::pair< int, int > &  p) const
inlinenoexcept

Computes a hash value for a pair of integers.

The hash is built from the first component, then combined with the second using a Boost-style mixing step: h ^= (second + constant + (h << 6) + (h >> 2));

Parameters
pPair of integers to hash.
Returns
Combined hash value.

Definition at line 45 of file hash_utils.hpp.


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