forked from boostorg/unordered
redesigned init_type/value_type machinery
This commit is contained in:
1 parent
2cf9d5ac4c
commit
d02b12c9a1
3 files changed
+25
-26
No files matched your search
@@ -829,6 +829,11 @@ table:empty_value<Hash,0>,empty_value<Pred,1>,empty_value<Allocator,1>
|
||||
public:
|
||||
using key_type=typename type_policy::key_type;
|
||||
using init_type=typename type_policy::init_type;
|
||||
|
||||
private:
|
||||
using moved_type=typename type_policy::moved_type;
|
||||
|
||||
public:
|
||||
using value_type=typename type_policy::value_type;
|
||||
|
||||
private:
|
||||
@@ -995,7 +1000,7 @@ public:
|
||||
*/
|
||||
|
||||
x.for_all_elements([this](value_type* p){
|
||||
unchecked_insert(std::move(*p));
|
||||
unchecked_insert(type_policy::move(*p));
|
||||
});
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
@@ -1221,6 +1226,17 @@ private:
|
||||
return type_policy::extract(x);
|
||||
}
|
||||
|
||||
template<
|
||||
bool dependent_value=false,
|
||||
typename std::enable_if<
|
||||
has_different_init_type||dependent_value>::type* =nullptr
|
||||
>
|
||||
static inline auto key_from(const moved_type& x)
|
||||
->decltype(type_policy::extract(x))
|
||||
{
|
||||
return type_policy::extract(x);
|
||||
}
|
||||
|
||||
static inline auto key_from(const value_type& x)
|
||||
->decltype(type_policy::extract(x))
|
||||
{
|
||||
@@ -1361,9 +1377,8 @@ private:
|
||||
void nosize_transfer_element(value_type* p,const arrays_type& arrays_)
|
||||
{
|
||||
auto hash=h()(key_from(*p));
|
||||
type_policy::move_parts_to(
|
||||
*p,
|
||||
bind_unchecked_emplace_at{this,arrays_,position_for(hash,arrays_),hash});
|
||||
nosize_unchecked_emplace_at(
|
||||
arrays_,position_for(hash,arrays_),hash,type_policy::move(*p));
|
||||
destroy_element(p);
|
||||
}
|
||||
|
||||
@@ -1429,21 +1444,6 @@ private:
|
||||
}
|
||||
#endif
|
||||
|
||||
struct bind_unchecked_emplace_at
|
||||
{
|
||||
template<typename... Args>
|
||||
iterator operator()(Args&&... args)const
|
||||
{
|
||||
return this_->nosize_unchecked_emplace_at(
|
||||
arrays,pos0,hash,std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
table* this_;
|
||||
const arrays_type& arrays;
|
||||
std::size_t pos0;
|
||||
std::size_t hash;
|
||||
};
|
||||
|
||||
template<typename F>
|
||||
void for_all_elements(F f)const
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user