From 9e2bf3681f00bded93f37ebc351e696f8315b173 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Mon, 10 Oct 2022 20:51:47 +0200 Subject: [PATCH] embedded hash into mixing policies --- include/boost/unordered/detail/foa.hpp | 33 +++++++++++++++----------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/include/boost/unordered/detail/foa.hpp b/include/boost/unordered/detail/foa.hpp index f379e80e..fca3b2c0 100644 --- a/include/boost/unordered/detail/foa.hpp +++ b/include/boost/unordered/detail/foa.hpp @@ -590,6 +590,24 @@ private: std::size_t pos,step=0; }; +struct no_mix +{ + template + static inline std::size_t mix(const Hash& h,const T& x) + { + return h(x); + } +}; + +struct xmx_mix +{ + template + static inline std::size_t mix(const Hash& h,const T& x) + { + return xmx(h(x)); + } +}; + template class table; @@ -755,19 +773,6 @@ struct table_arrays value_type *elements; }; -struct no_mix -{ - static inline std::size_t mix(std::size_t x)noexcept{return x;} -}; - -struct xmx_mix -{ - static inline std::size_t mix(std::size_t x)noexcept - { - return xmx(x); - } -}; - struct if_constexpr_void_else{void operator()()const{}}; template @@ -1317,7 +1322,7 @@ private: template inline std::size_t hash_for(const Key& x)const { - return mix_policy::mix(h()(x)); + return mix_policy::mix(h(),x); } inline std::size_t position_for(std::size_t hash)const