From 259e4a939f3b69c79cd136d87f9f6479deb98104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sat, 31 Oct 2015 00:53:10 +0100 Subject: [PATCH] Fix Trac #11765 ("sgtree.hpp:830: bad if test?") --- doc/intrusive.qbk | 1 + include/boost/intrusive/sgtree.hpp | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/intrusive.qbk b/doc/intrusive.qbk index cb8f502..bfa5302 100644 --- a/doc/intrusive.qbk +++ b/doc/intrusive.qbk @@ -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] diff --git a/include/boost/intrusive/sgtree.hpp b/include/boost/intrusive/sgtree.hpp index dc84c80..b4c4cde 100644 --- a/include/boost/intrusive/sgtree.hpp +++ b/include/boost/intrusive/sgtree.hpp @@ -826,18 +826,17 @@ class sgtree_impl //! Complexity: 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(); + } } }