hash/mix: add a simple std compatible wrapper for hash::mix

This commit is contained in:
Danny Robson 2023-07-24 12:55:48 +10:00
parent db95fd532b
commit cb06fb9b29
3 changed files with 26 additions and 0 deletions

View File

@ -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
View File

@ -0,0 +1 @@
#include "./mix.hpp"

23
hash/mix.hpp Normal file
View 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)...
);
}
};
}