Version: SMASH-2.0
smash::pair_hash Struct Reference

#include <parametrizations.h>

Hash a pair of integers.

Note that symmetric pairs and permutations yield identical hashes with this implementation.

Definition at line 436 of file parametrizations.h.

Public Member Functions

std::size_t operator() (const std::pair< uint64_t, uint64_t > &p) const
 Hashing is done by this operator. More...
 

Member Function Documentation

◆ operator()()

std::size_t smash::pair_hash::operator() ( const std::pair< uint64_t, uint64_t > &  p) const
inline

Hashing is done by this operator.

Definition at line 438 of file parametrizations.h.

438  {
439  auto h1 = std::hash<uint64_t>{}(p.first);
440  auto h2 = std::hash<uint64_t>{}(p.second);
441 
442  /* In our case the integers are PDG codes. We know they are different
443  * and their order is defined, so we can simply combine the hashes
444  * using XOR. Note that this yields 0 for h1 == h2. Also,
445  * std::swap(h1, h2) does not not change the final hash. */
446  assert(h1 != h2);
447  return h1 ^ h2;
448  }

The documentation for this struct was generated from the following file:
smash::pdg::h1
constexpr int h1
h₁(1170).
Definition: pdgcode_constants.h:90
smash::pdg::p
constexpr int p
Proton.
Definition: pdgcode_constants.h:28