Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67450 - in trunk/boost/intrusive: . detail
From: igaztanaga_at_[hidden]
Date: 2010-12-26 04:48:40


Author: igaztanaga
Date: 2010-12-26 04:48:36 EST (Sun, 26 Dec 2010)
New Revision: 67450
URL: http://svn.boost.org/trac/boost/changeset/67450

Log:
Fixed wrong count when compare throws
Text files modified:
   trunk/boost/intrusive/avltree.hpp | 21 ++++++++++++---------
   trunk/boost/intrusive/detail/tree_node.hpp | 2 +-
   trunk/boost/intrusive/rbtree.hpp | 12 +++++++-----
   trunk/boost/intrusive/sgtree.hpp | 12 ++++++------
   trunk/boost/intrusive/splaytree.hpp | 12 +++++++-----
   trunk/boost/intrusive/treap.hpp | 21 ++++++++++++---------
   6 files changed, 45 insertions(+), 35 deletions(-)

Modified: trunk/boost/intrusive/avltree.hpp
==============================================================================
--- trunk/boost/intrusive/avltree.hpp (original)
+++ trunk/boost/intrusive/avltree.hpp 2010-12-26 04:48:36 EST (Sun, 26 Dec 2010)
@@ -465,9 +465,10 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal_upper_bound
+ iterator ret(node_algorithms::insert_equal_upper_bound
          (node_ptr(&priv_header()), to_insert, key_node_comp), this);
+ this->priv_size_traits().increment();
+ return ret;
    }
 
    //! <b>Requires</b>: value must be an lvalue, and "hint" must be
@@ -491,9 +492,10 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal
+ iterator ret(node_algorithms::insert_equal
          (node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp), this);
+ this->priv_size_traits().increment();
+ return ret;
    }
 
    //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
@@ -698,9 +700,9 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       node_algorithms::insert_unique_commit
                (node_ptr(&priv_header()), to_insert, commit_data);
+ this->priv_size_traits().increment();
       return iterator(to_insert, this);
    }
 
@@ -723,9 +725,10 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_before
+ iterator ret(node_algorithms::insert_before
          (node_ptr(&priv_header()), pos.pointed_node(), to_insert), this);
+ this->priv_size_traits().increment();
+ return ret;
    }
 
    //! <b>Requires</b>: value must be an lvalue, and it must be no less
@@ -747,8 +750,8 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       node_algorithms::push_back(node_ptr(&priv_header()), to_insert);
+ this->priv_size_traits().increment();
    }
 
    //! <b>Requires</b>: value must be an lvalue, and it must be no greater
@@ -770,8 +773,8 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       node_algorithms::push_front(node_ptr(&priv_header()), to_insert);
+ this->priv_size_traits().increment();
    }
 
    //! <b>Effects</b>: Erases the element pointed to by pos.

Modified: trunk/boost/intrusive/detail/tree_node.hpp
==============================================================================
--- trunk/boost/intrusive/detail/tree_node.hpp (original)
+++ trunk/boost/intrusive/detail/tree_node.hpp 2010-12-26 04:48:36 EST (Sun, 26 Dec 2010)
@@ -96,7 +96,7 @@
 
 
    tree_iterator()
- : members_ (0, 0)
+ : members_ (node_ptr(0), (const void *)0)
    {}
 
    explicit tree_iterator(node_ptr nodeptr, const Container *cont_ptr)

Modified: trunk/boost/intrusive/rbtree.hpp
==============================================================================
--- trunk/boost/intrusive/rbtree.hpp (original)
+++ trunk/boost/intrusive/rbtree.hpp 2010-12-26 04:48:36 EST (Sun, 26 Dec 2010)
@@ -478,9 +478,10 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal_upper_bound
+ iterator ret(node_algorithms::insert_equal_upper_bound
          (node_ptr(&priv_header()), to_insert, key_node_comp), this);
+ this->priv_size_traits().increment();
+ return ret;
    }
 
    //! <b>Requires</b>: value must be an lvalue, and "hint" must be
@@ -504,9 +505,10 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal
+ iterator ret(node_algorithms::insert_equal
          (node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp), this);
+ this->priv_size_traits().increment();
+ return ret;
    }
 
    //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
@@ -711,9 +713,9 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       node_algorithms::insert_unique_commit
                (node_ptr(&priv_header()), to_insert, commit_data);
+ this->priv_size_traits().increment();
       return iterator(to_insert, this);
    }
 

Modified: trunk/boost/intrusive/sgtree.hpp
==============================================================================
--- trunk/boost/intrusive/sgtree.hpp (original)
+++ trunk/boost/intrusive/sgtree.hpp 2010-12-26 04:48:36 EST (Sun, 26 Dec 2010)
@@ -621,11 +621,11 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
       node_ptr p = node_algorithms::insert_equal_upper_bound
          (node_ptr(&priv_header()), to_insert, key_node_comp
          , (size_type)this->size(), this->get_h_alpha_func(), max_tree_size);
+ this->priv_size_traits().increment();
       data_.max_tree_size_ = (size_type)max_tree_size;
       return iterator(p, this);
    }
@@ -651,11 +651,11 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
       node_ptr p = node_algorithms::insert_equal
          (node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp
          , (std::size_t)this->size(), this->get_h_alpha_func(), max_tree_size);
+ this->priv_size_traits().increment();
       data_.max_tree_size_ = (size_type)max_tree_size;
       return iterator(p, this);
    }
@@ -862,11 +862,11 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
       node_algorithms::insert_unique_commit
          ( node_ptr(&priv_header()), to_insert, commit_data
          , (std::size_t)this->size(), this->get_h_alpha_func(), max_tree_size);
+ this->priv_size_traits().increment();
       data_.max_tree_size_ = (size_type)max_tree_size;
       return iterator(to_insert, this);
    }
@@ -890,11 +890,11 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
       node_ptr p = node_algorithms::insert_before
          ( node_ptr(&priv_header()), pos.pointed_node(), to_insert
          , (size_type)this->size(), this->get_h_alpha_func(), max_tree_size);
+ this->priv_size_traits().increment();
       data_.max_tree_size_ = (size_type)max_tree_size;
       return iterator(p, this);
    }
@@ -918,11 +918,11 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
       node_algorithms::push_back
          ( node_ptr(&priv_header()), to_insert
          , (size_type)this->size(), this->get_h_alpha_func(), max_tree_size);
+ this->priv_size_traits().increment();
       data_.max_tree_size_ = (size_type)max_tree_size;
    }
 
@@ -945,11 +945,11 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
       node_algorithms::push_front
          ( node_ptr(&priv_header()), to_insert
          , (size_type)this->size(), this->get_h_alpha_func(), max_tree_size);
+ this->priv_size_traits().increment();
       data_.max_tree_size_ = (size_type)max_tree_size;
    }
 

Modified: trunk/boost/intrusive/splaytree.hpp
==============================================================================
--- trunk/boost/intrusive/splaytree.hpp (original)
+++ trunk/boost/intrusive/splaytree.hpp 2010-12-26 04:48:36 EST (Sun, 26 Dec 2010)
@@ -466,9 +466,10 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal_lower_bound
+ iterator ret (node_algorithms::insert_equal_lower_bound
          (node_ptr(&priv_header()), to_insert, key_node_comp), this);
+ this->priv_size_traits().increment();
+ return ret;
    }
 
    //! <b>Requires</b>: value must be an lvalue, and "hint" must be
@@ -492,9 +493,10 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal
+ iterator ret(node_algorithms::insert_equal
          (node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp), this);
+ this->priv_size_traits().increment();
+ return ret;
    }
 
    //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
@@ -693,9 +695,9 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       node_algorithms::insert_unique_commit
                (node_ptr(&priv_header()), to_insert, commit_data);
+ this->priv_size_traits().increment();
       return iterator(to_insert, this);
    }
 

Modified: trunk/boost/intrusive/treap.hpp
==============================================================================
--- trunk/boost/intrusive/treap.hpp (original)
+++ trunk/boost/intrusive/treap.hpp 2010-12-26 04:48:36 EST (Sun, 26 Dec 2010)
@@ -549,9 +549,10 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal_upper_bound
+ iterator ret(node_algorithms::insert_equal_upper_bound
          (node_ptr(&priv_header()), to_insert, key_node_comp, key_node_pcomp), this);
+ this->priv_size_traits().increment();
+ return ret;
    }
 
    //! <b>Requires</b>: value must be an lvalue, and "hint" must be
@@ -577,9 +578,10 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal
+ iterator ret (node_algorithms::insert_equal
          (node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp, key_node_pcomp), this);
+ this->priv_size_traits().increment();
+ return ret;
    }
 
    //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
@@ -801,8 +803,8 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       node_algorithms::insert_unique_commit(node_ptr(&priv_header()), to_insert, commit_data);
+ this->priv_size_traits().increment();
       return iterator(to_insert, this);
    }
 
@@ -825,11 +827,12 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       detail::key_nodeptr_comp<priority_compare, treap_impl>
          pcomp(priv_pcomp(), this);
- return iterator(node_algorithms::insert_before
+ iterator ret (node_algorithms::insert_before
          (node_ptr(&priv_header()), pos.pointed_node(), to_insert, pcomp), this);
+ this->priv_size_traits().increment();
+ return ret;
    }
 
    //! <b>Requires</b>: value must be an lvalue, and it must be no less
@@ -851,10 +854,10 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       detail::key_nodeptr_comp<priority_compare, treap_impl>
          pcomp(priv_pcomp(), this);
       node_algorithms::push_back(node_ptr(&priv_header()), to_insert, pcomp);
+ this->priv_size_traits().increment();
    }
 
    //! <b>Requires</b>: value must be an lvalue, and it must be no greater
@@ -876,10 +879,10 @@
       node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
       if(safemode_or_autounlink)
          BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
       detail::key_nodeptr_comp<priority_compare, treap_impl>
          pcomp(priv_pcomp(), this);
       node_algorithms::push_front(node_ptr(&priv_header()), to_insert, pcomp);
+ this->priv_size_traits().increment();
    }
 
    //! <b>Effects</b>: Erases the element pointed to by pos.


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk