Fixed wrong call to vector::merge_unique in insert_unique and used placement construction in priv_merge_in_new_buffer

This commit is contained in:
Ion Gaztañaga
2015-07-21 23:40:52 +02:00
parent a7f60c1e8c
commit a91f6d317b
2 changed files with 7 additions and 5 deletions

View File

@@ -506,7 +506,7 @@ class flat_tree
>::type * = 0
#endif
)
{ this->m_data.m_vect.merge_unique(first, last); }
{ this->m_data.m_vect.merge_unique(first, last, value_compare()); }
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)

View File

@@ -2292,7 +2292,7 @@ class vector
//Merge in new buffer loop
while(1){
if(!n) {
::boost::container::uninitialized_move_alloc(this->m_holder.alloc(), pbeg, pend, d_first);
::boost::container::uninitialized_move_alloc(this->m_holder.alloc(), pbeg, pend, d_first);
break;
}
else if(pbeg == pend) {
@@ -2300,8 +2300,9 @@ class vector
break;
}
//maintain stability moving external values only if they are strictly less
else if(comp(*first, *pbeg)) {
*d_first = ::boost::move(*first);
else if(comp(*first, *pbeg)) {
allocator_traits_type::construct( this->m_holder.alloc(), d_first, ::boost::move(*first) );
new_values_destroyer.increment_size(1u);
++first;
--n;
++d_first;
@@ -2312,7 +2313,8 @@ class vector
--added;
}
else{
*d_first = ::boost::move(*pbeg);
allocator_traits_type::construct( this->m_holder.alloc(), d_first, ::boost::move(*pbeg) );
new_values_destroyer.increment_size(1u);
++pbeg;
++d_first;
}