embedded hash into mixing policies

This commit is contained in:
joaquintides
2022-10-10 20:51:47 +02:00
parent 77f265a678
commit 9e2bf3681f

View File

@ -590,6 +590,24 @@ private:
std::size_t pos,step=0;
};
struct no_mix
{
template<typename Hash,typename T>
static inline std::size_t mix(const Hash& h,const T& x)
{
return h(x);
}
};
struct xmx_mix
{
template<typename Hash,typename T>
static inline std::size_t mix(const Hash& h,const T& x)
{
return xmx(h(x));
}
};
template<typename,typename,typename,typename>
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<bool B,typename F,typename G=if_constexpr_void_else>
@ -1317,7 +1322,7 @@ private:
template<typename Key>
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