forked from boostorg/intrusive
Fix Trac #11765 ("sgtree.hpp:830: bad if test?")
This commit is contained in:
@@ -3842,6 +3842,7 @@ to be inserted in intrusive containers are allocated using `std::vector` or `std
|
|||||||
the container must be partitioned in regards to the passed comparison object.
|
the container must be partitioned in regards to the passed comparison object.
|
||||||
* Fixed bugs:
|
* Fixed bugs:
|
||||||
* [@https://svn.boost.org/trac/boost/ticket/11701 Boost Trac #11701: ['Regression in boost::intrusive::set::equal_range]]
|
* [@https://svn.boost.org/trac/boost/ticket/11701 Boost Trac #11701: ['Regression in boost::intrusive::set::equal_range]]
|
||||||
|
* [@https://svn.boost.org/trac/boost/ticket/11765 Boost Trac #11765: ['sgtree.hpp:830: bad if test ?]]
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
@@ -826,20 +826,19 @@ class sgtree_impl
|
|||||||
//! <b>Complexity</b>: Linear to the elements in the subtree.
|
//! <b>Complexity</b>: Linear to the elements in the subtree.
|
||||||
void balance_factor(float new_alpha)
|
void balance_factor(float new_alpha)
|
||||||
{
|
{
|
||||||
BOOST_INTRUSIVE_INVARIANT_ASSERT((new_alpha > 0.5f && new_alpha < 1.0f));
|
|
||||||
if(new_alpha < 0.5f && new_alpha >= 1.0f) return;
|
|
||||||
|
|
||||||
//The alpha factor CAN't be changed if the fixed, floating operation-less
|
//The alpha factor CAN't be changed if the fixed, floating operation-less
|
||||||
//1/sqrt(2) alpha factor option is activated
|
//1/sqrt(2) alpha factor option is activated
|
||||||
BOOST_STATIC_ASSERT((floating_point));
|
BOOST_STATIC_ASSERT((floating_point));
|
||||||
|
BOOST_INTRUSIVE_INVARIANT_ASSERT((new_alpha > 0.5f && new_alpha < 1.0f));
|
||||||
|
if(new_alpha >= 0.5f && new_alpha < 1.0f){
|
||||||
float old_alpha = this->get_alpha_traits().get_alpha();
|
float old_alpha = this->get_alpha_traits().get_alpha();
|
||||||
this->get_alpha_traits().set_alpha(new_alpha);
|
this->get_alpha_traits().set_alpha(new_alpha);
|
||||||
|
|
||||||
if(new_alpha < old_alpha){
|
if(new_alpha < old_alpha){
|
||||||
this->max_tree_size_ = this->size();
|
this->max_tree_size_ = this->size();
|
||||||
this->rebalance();
|
this->rebalance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// @cond
|
/// @cond
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user