hash/mix: add a simple std compatible wrapper for hash::mix
This commit is contained in:
parent
db95fd532b
commit
cb06fb9b29
@ -412,6 +412,8 @@ list (
|
||||
hash/fnv1a.hpp
|
||||
hash/halfsipmix.cpp
|
||||
hash/halfsipmix.hpp
|
||||
hash/mix.cpp
|
||||
hash/mix.hpp
|
||||
hash/murmur/common.cpp
|
||||
hash/murmur/common.hpp
|
||||
hash/murmur.hpp
|
||||
|
1
hash/mix.cpp
Normal file
1
hash/mix.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "./mix.hpp"
|
23
hash/mix.hpp
Normal file
23
hash/mix.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "../hash.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
|
||||
namespace cruft::hash {
|
||||
/// A std compatible adapter for a variadic 'mix' hash.
|
||||
///
|
||||
/// It combines multiple values in a way that is unlikely to result in collisions.
|
||||
///
|
||||
/// The exact implementation is not defined.
|
||||
struct mixer {
|
||||
template <typename ...ValueT>
|
||||
auto operator () (ValueT &&...elements)
|
||||
{
|
||||
return cruft::hash::mix (
|
||||
std::forward<ValueT> (elements)...
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user