mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-31 03:47:16 +02:00
fixed init_type machinery
This commit is contained in:
@ -828,12 +828,14 @@ table:empty_value<Hash,0>,empty_value<Pred,1>,empty_value<Allocator,1>
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
using key_type=typename type_policy::key_type;
|
using key_type=typename type_policy::key_type;
|
||||||
using init_type=typename type_policy::value_type;
|
using init_type=typename type_policy::init_type;
|
||||||
using value_type=typename type_policy::value_type;
|
using value_type=typename type_policy::value_type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr bool has_mutable_iterator=
|
static constexpr bool has_mutable_iterator=
|
||||||
!std::is_same<key_type,value_type>::value;
|
!std::is_same<key_type,value_type>::value;
|
||||||
|
static constexpr bool has_different_init_type=
|
||||||
|
!std::is_same<init_type,value_type>::value;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using hasher=Hash;
|
using hasher=Hash;
|
||||||
@ -1207,6 +1209,17 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<
|
||||||
|
bool dependent_value=false,
|
||||||
|
typename std::enable_if<
|
||||||
|
has_different_init_type||dependent_value>::type* =nullptr
|
||||||
|
>
|
||||||
|
static inline auto key_from(const init_type& x)
|
||||||
|
->decltype(type_policy::extract(x))
|
||||||
|
{
|
||||||
|
return type_policy::extract(x);
|
||||||
|
}
|
||||||
|
|
||||||
static inline auto key_from(const value_type& x)
|
static inline auto key_from(const value_type& x)
|
||||||
->decltype(type_policy::extract(x))
|
->decltype(type_policy::extract(x))
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,7 @@ namespace boost {
|
|||||||
using key_type = Key;
|
using key_type = Key;
|
||||||
using init_type = std::pair<Key, T>;
|
using init_type = std::pair<Key, T>;
|
||||||
using value_type = std::pair<Key const, T>;
|
using value_type = std::pair<Key const, T>;
|
||||||
|
static Key const& extract(init_type const& kv) { return kv.first; }
|
||||||
static Key const& extract(value_type const& kv) { return kv.first; }
|
static Key const& extract(value_type const& kv) { return kv.first; }
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
|
Reference in New Issue
Block a user