forked from boostorg/unordered
refactored emplace_impl to improve inlining
This commit is contained in:
@ -1595,9 +1595,26 @@ private:
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
return {
|
||||||
|
unchecked_emplace_with_rehash(hash,std::forward<Args>(args)...),
|
||||||
|
true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::size_t capacity_for(std::size_t n)
|
||||||
|
{
|
||||||
|
return size_policy::size(size_index_for<group_type,size_policy>(n))*N-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename... Args>
|
||||||
|
BOOST_NOINLINE iterator
|
||||||
|
unchecked_emplace_with_rehash(std::size_t hash,Args&&... args)
|
||||||
|
{
|
||||||
/* strong exception guarantee -> try insertion before rehash */
|
/* strong exception guarantee -> try insertion before rehash */
|
||||||
auto new_arrays_=new_arrays(
|
auto new_arrays_=new_arrays(
|
||||||
std::size_t(std::ceil(static_cast<float>(size_+1)/mlf)));
|
std::size_t(std::ceil(static_cast<float>(size_+1)/mlf)));
|
||||||
|
iterator it;
|
||||||
BOOST_TRY{
|
BOOST_TRY{
|
||||||
it=nosize_unchecked_emplace_at(
|
it=nosize_unchecked_emplace_at(
|
||||||
new_arrays_,position_for(hash,new_arrays_),
|
new_arrays_,position_for(hash,new_arrays_),
|
||||||
@ -1612,13 +1629,7 @@ private:
|
|||||||
/* new_arrays_ lifetime taken care of by unchecked_rehash */
|
/* new_arrays_ lifetime taken care of by unchecked_rehash */
|
||||||
unchecked_rehash(new_arrays_);
|
unchecked_rehash(new_arrays_);
|
||||||
++size_;
|
++size_;
|
||||||
return {it,true};
|
return it;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::size_t capacity_for(std::size_t n)
|
|
||||||
{
|
|
||||||
return size_policy::size(size_index_for<group_type,size_policy>(n))*N-1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_NOINLINE void unchecked_rehash(std::size_t n)
|
BOOST_NOINLINE void unchecked_rehash(std::size_t n)
|
||||||
|
Reference in New Issue
Block a user