mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17:15 +02:00
embedded hash into mixing policies
This commit is contained in:
@ -590,6 +590,24 @@ private:
|
|||||||
std::size_t pos,step=0;
|
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>
|
template<typename,typename,typename,typename>
|
||||||
class table;
|
class table;
|
||||||
|
|
||||||
@ -755,19 +773,6 @@ struct table_arrays
|
|||||||
value_type *elements;
|
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{}};
|
struct if_constexpr_void_else{void operator()()const{}};
|
||||||
|
|
||||||
template<bool B,typename F,typename G=if_constexpr_void_else>
|
template<bool B,typename F,typename G=if_constexpr_void_else>
|
||||||
@ -1317,7 +1322,7 @@ private:
|
|||||||
template<typename Key>
|
template<typename Key>
|
||||||
inline std::size_t hash_for(const Key& x)const
|
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
|
inline std::size_t position_for(std::size_t hash)const
|
||||||
|
Reference in New Issue
Block a user