mirror of
https://github.com/boostorg/container.git
synced 2025-08-03 22:44:26 +02:00
@@ -491,9 +491,9 @@ class flat_tree
|
|||||||
const const_iterator beg(this->cbegin());
|
const const_iterator beg(this->cbegin());
|
||||||
const_iterator pos(beg);
|
const_iterator pos(beg);
|
||||||
const value_compare &value_comp = this->m_data;
|
const value_compare &value_comp = this->m_data;
|
||||||
|
skips[0u] = 0u;
|
||||||
//Loop in burst sizes
|
//Loop in burst sizes
|
||||||
while(len){
|
while(len){
|
||||||
skips[0u] = 0u;
|
|
||||||
const size_type burst = len < BurstSize ? len : BurstSize;
|
const size_type burst = len < BurstSize ? len : BurstSize;
|
||||||
size_type unique_burst = 0u;
|
size_type unique_burst = 0u;
|
||||||
const const_iterator cend(this->cend());
|
const const_iterator cend(this->cend());
|
||||||
@@ -503,20 +503,23 @@ class flat_tree
|
|||||||
--len;
|
--len;
|
||||||
pos = const_cast<const flat_tree&>(*this).priv_lower_bound(pos, cend, KeyOfValue()(val));
|
pos = const_cast<const flat_tree&>(*this).priv_lower_bound(pos, cend, KeyOfValue()(val));
|
||||||
//Check if already present
|
//Check if already present
|
||||||
if(pos != cend && !value_comp(*pos, val)){
|
if(pos != cend && !value_comp(val, *pos)){
|
||||||
++skips[unique_burst];
|
if(unique_burst > 0){
|
||||||
|
++skips[unique_burst-1];
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If not present, calculate position
|
//If not present, calculate position
|
||||||
positions[unique_burst] = static_cast<size_type>(pos - beg);
|
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;
|
||||||
}
|
}
|
||||||
//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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -683,15 +683,6 @@ class vector : private container_detail::vector_alloc_holder<A>
|
|||||||
allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
|
allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
|
||||||
{ return this->alloc(); }
|
{ 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.
|
//! <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
|
stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
|
||||||
{ return this->alloc(); }
|
{ 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
|
// iterators
|
||||||
@@ -957,7 +958,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
|||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: Linear to size().
|
//! <b>Complexity</b>: Linear to size().
|
||||||
void shrink_to_fit()
|
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,
|
//Loop for each insertion backwards, first moving the elements after the insertion point,
|
||||||
//then inserting the element.
|
//then inserting the element.
|
||||||
while(insertions_left){
|
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));
|
const size_type pos = static_cast<size_type>(*(--last_position_it));
|
||||||
BOOST_ASSERT(pos <= old_size_pos);
|
BOOST_ASSERT(pos <= old_size_pos);
|
||||||
//If needed shift the range after the insertion point and the previous insertion point.
|
//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
|
//Insert the new value in the already constructed range
|
||||||
begin_ptr[pos + insertions_left - 1] = *(--last_value_it);
|
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;
|
--insertions_left;
|
||||||
hole_size = new_hole_size;
|
hole_size = new_hole_size;
|
||||||
next_pos = pos;
|
next_pos = pos;
|
||||||
|
Reference in New Issue
Block a user