forked from boostorg/container
Document block_size option in deque_options.
This commit is contained in:
@@ -913,26 +913,13 @@ class basic_string
|
||||
|| allocator_traits_type::is_always_equal::value)
|
||||
{
|
||||
if (BOOST_LIKELY(this != &x)) {
|
||||
allocator_type &this_alloc = this->alloc();
|
||||
allocator_type &x_alloc = x.alloc();
|
||||
const bool propagate_alloc = allocator_traits_type::
|
||||
propagate_on_container_move_assignment::value;
|
||||
dtl::bool_<propagate_alloc> flag;
|
||||
const bool allocators_equal = this_alloc == x_alloc; (void)allocators_equal;
|
||||
//Resources can be transferred if both allocators are
|
||||
//going to be equal after this function (either propagated or already equal)
|
||||
if(propagate_alloc || allocators_equal){
|
||||
//Destroy objects but retain memory in case x reuses it in the future
|
||||
this->clear();
|
||||
//Move allocator if needed
|
||||
dtl::move_alloc(this_alloc, x_alloc, flag);
|
||||
//Nothrow swap
|
||||
this->swap_data(x);
|
||||
}
|
||||
//Else do a one by one move
|
||||
else{
|
||||
this->assign( x.begin(), x.end());
|
||||
}
|
||||
//We know resources can be transferred at comiple time if both allocators are
|
||||
//always equal or the allocator is going to be propagated
|
||||
const bool can_steal_resources_alloc
|
||||
= allocator_traits_type::propagate_on_container_move_assignment::value
|
||||
|| allocator_traits_type::is_always_equal::value;
|
||||
dtl::bool_<can_steal_resources_alloc> flag;
|
||||
this->priv_move_assign(boost::move(x), flag);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -2908,6 +2895,30 @@ class basic_string
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
private:
|
||||
void priv_move_assign(BOOST_RV_REF(basic_string) x, dtl::bool_<true> /*steal_resources*/)
|
||||
{
|
||||
//Destroy objects but retain memory in case x reuses it in the future
|
||||
this->clear();
|
||||
//Move allocator if needed
|
||||
dtl::bool_<allocator_traits_type::
|
||||
propagate_on_container_move_assignment::value> flag;
|
||||
dtl::move_alloc(this->alloc(), x.alloc(), flag);
|
||||
//Nothrow swap
|
||||
this->swap_data(x);
|
||||
}
|
||||
|
||||
void priv_move_assign(BOOST_RV_REF(basic_string) x, dtl::bool_<false> /*steal_resources*/)
|
||||
{
|
||||
//We can't guarantee a compile-time equal allocator or propagation so fallback to runtime
|
||||
//Resources can be transferred if both allocators are equal
|
||||
if (this->alloc() == x.alloc()) {
|
||||
this->priv_move_assign(boost::move(x), dtl::true_());
|
||||
}
|
||||
else {
|
||||
this->assign(x.begin(), x.end());
|
||||
}
|
||||
}
|
||||
|
||||
bool priv_reserve_no_null_end(size_type res_arg)
|
||||
{
|
||||
if (res_arg > this->max_size()){
|
||||
|
||||
Reference in New Issue
Block a user