Fix Trac #11765 ("sgtree.hpp:830: bad if test?")

This commit is contained in:
Ion Gaztañaga
2015-10-31 00:53:10 +01:00
parent 3c818c66a4
commit 259e4a939f
2 changed files with 9 additions and 9 deletions

View File

@ -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.
* 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/11765 Boost Trac #11765: ['sgtree.hpp:830: bad if test ?]]
[endsect]

View File

@ -826,18 +826,17 @@ class sgtree_impl
//! <b>Complexity</b>: Linear to the elements in the subtree.
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
//1/sqrt(2) alpha factor option is activated
BOOST_STATIC_ASSERT((floating_point));
float old_alpha = this->get_alpha_traits().get_alpha();
this->get_alpha_traits().set_alpha(new_alpha);
if(new_alpha < old_alpha){
this->max_tree_size_ = this->size();
this->rebalance();
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();
this->get_alpha_traits().set_alpha(new_alpha);
if(new_alpha < old_alpha){
this->max_tree_size_ = this->size();
this->rebalance();
}
}
}