mirror of
https://github.com/boostorg/container.git
synced 2025-08-03 06:24:26 +02:00
@@ -491,9 +491,9 @@ class flat_tree
|
||||
const const_iterator beg(this->cbegin());
|
||||
const_iterator pos(beg);
|
||||
const value_compare &value_comp = this->m_data;
|
||||
skips[0u] = 0u;
|
||||
//Loop in burst sizes
|
||||
while(len){
|
||||
skips[0u] = 0u;
|
||||
const size_type burst = len < BurstSize ? len : BurstSize;
|
||||
size_type unique_burst = 0u;
|
||||
const const_iterator cend(this->cend());
|
||||
@@ -503,22 +503,25 @@ class flat_tree
|
||||
--len;
|
||||
pos = const_cast<const flat_tree&>(*this).priv_lower_bound(pos, cend, KeyOfValue()(val));
|
||||
//Check if already present
|
||||
if(pos != cend && !value_comp(*pos, val)){
|
||||
++skips[unique_burst];
|
||||
if(pos != cend && !value_comp(val, *pos)){
|
||||
if(unique_burst > 0){
|
||||
++skips[unique_burst-1];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
//If not present, calculate position
|
||||
positions[unique_burst] = static_cast<size_type>(pos - beg);
|
||||
if(++unique_burst < burst)
|
||||
skips[unique_burst] = 0u;
|
||||
skips[unique_burst++] = 0u;
|
||||
}
|
||||
if(unique_burst){
|
||||
//Insert all in a single step in the precalculated positions
|
||||
this->m_data.m_vect.insert_ordered_at(unique_burst, positions + unique_burst, skips + unique_burst, first);
|
||||
//Next search position updated
|
||||
pos += unique_burst;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
|
||||
|
||||
|
@@ -683,15 +683,6 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->alloc(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reference to the internal allocator.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->alloc(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reference to the internal allocator.
|
||||
//!
|
||||
@@ -703,6 +694,16 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->alloc(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reference to the internal allocator.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->alloc(); }
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//
|
||||
// iterators
|
||||
@@ -957,7 +958,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to size().
|
||||
void shrink_to_fit()
|
||||
{ priv_shrink_to_fit(alloc_version()); }
|
||||
{ this->priv_shrink_to_fit(alloc_version()); }
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//
|
||||
@@ -1535,6 +1536,10 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//Loop for each insertion backwards, first moving the elements after the insertion point,
|
||||
//then inserting the element.
|
||||
while(insertions_left){
|
||||
if(do_skip){
|
||||
size_type n = *(--last_skip_it);
|
||||
std::advance(last_value_it, -difference_type(n));
|
||||
}
|
||||
const size_type pos = static_cast<size_type>(*(--last_position_it));
|
||||
BOOST_ASSERT(pos <= old_size_pos);
|
||||
//If needed shift the range after the insertion point and the previous insertion point.
|
||||
@@ -1569,12 +1574,6 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//Insert the new value in the already constructed range
|
||||
begin_ptr[pos + insertions_left - 1] = *(--last_value_it);
|
||||
}
|
||||
if(do_skip){
|
||||
size_type n = *(--last_skip_it);
|
||||
while(n--){
|
||||
--last_value_it;
|
||||
}
|
||||
}
|
||||
--insertions_left;
|
||||
hole_size = new_hole_size;
|
||||
next_pos = pos;
|
||||
|
Reference in New Issue
Block a user