KiCad PCB EDA Suite
hash.h File Reference
#include <functional>

Go to the source code of this file.

Macros

#define LIBS_KIMATH_INCLUDE_HASH_H_
 

Functions

static void hash_combine (std::size_t &seed)
 This is a dummy function to take the final case of hash_combine below. More...
 
template<typename T , typename ... Types>
static void hash_combine (std::size_t &seed, const T &val, const Types &... args)
 Combine multiple hashes utilizing previous hash result. More...
 
template<typename... Types>
static std::size_t hash_val (const Types &... args)
 

Macro Definition Documentation

◆ LIBS_KIMATH_INCLUDE_HASH_H_

#define LIBS_KIMATH_INCLUDE_HASH_H_

Definition at line 26 of file hash.h.

Function Documentation

◆ hash_combine() [1/2]

static void hash_combine ( std::size_t &  seed)
inlinestatic

◆ hash_combine() [2/2]

template<typename T , typename ... Types>
static void hash_combine ( std::size_t &  seed,
const T &  val,
const Types &...  args 
)
inlinestatic

Combine multiple hashes utilizing previous hash result.

Template Parameters
TA hashable type
Parameters
seedA seed value input and output for the result.
valA hashable object of type T

Definition at line 44 of file hash.h.

45{
46 seed ^= std::hash<T>()( val ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 );
47 hash_combine( seed, args... );
48}
static void hash_combine(std::size_t &seed)
This is a dummy function to take the final case of hash_combine below.
Definition: hash.h:34

References hash_combine().

◆ hash_val()

template<typename... Types>
static std::size_t hash_val ( const Types &...  args)
inlinestatic

Definition at line 51 of file hash.h.

52{
53 std::size_t seed = 0xa82de1c0;
54 hash_combine( seed, args... );
55 return seed;
56}

References hash_combine().