Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55512 - in sandbox/SOC/2006/tree/trunk/boost/tree: . detail
From: ockham_at_[hidden]
Date: 2009-08-10 18:40:05


Author: bernhard.reiter
Date: 2009-08-10 18:40:04 EDT (Mon, 10 Aug 2009)
New Revision: 55512
URL: http://svn.boost.org/trac/boost/changeset/55512

Log:
Change splice implementation semantics
Text files modified:
   sandbox/SOC/2006/tree/trunk/boost/tree/binary_tree.hpp | 2 +-
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/nary_node.hpp | 27 +++++++++++++--------------
   2 files changed, 14 insertions(+), 15 deletions(-)

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/binary_tree.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/binary_tree.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/binary_tree.hpp 2009-08-10 18:40:04 EDT (Mon, 10 Aug 2009)
@@ -382,7 +382,7 @@
     void splice(cursor position, binary_tree& x, cursor root)
     {
         // x isn't actually used currently...
- position.base_node()->splice(root.base_node(), position.m_pos);
+ detail::splice(position.base_node(), root.base_node()->m_children[position.m_pos], position.m_pos);
     }
 
     /**

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/nary_node.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/nary_node.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/nary_node.hpp 2009-08-10 18:40:04 EDT (Mon, 10 Aug 2009)
@@ -77,17 +77,16 @@
         m_children[m_pos] = p_node;
     }
 
- void splice(node_with_children_base* p_node, children_type::size_type m_pos)
- {
- m_children[m_pos] = p_node->m_children[m_pos];
-
- p_node->m_children[m_pos] = 0;
- }
-
 //protected:
     children_type m_children;
 };
 
+static void splice(node_with_children_base*& to, node_with_children_base*& from)
+{
+ to = from;
+ from = 0;
+}
+
 class node_base
 : public node_with_parent_base, public node_with_children_base {
     typedef node_base self_type;
@@ -135,13 +134,6 @@
 
         node_with_children_base::attach(p_node, m_pos);
     }
-
- void splice(base_pointer p_node, children_type::size_type m_pos)
- {
- static_cast<node_base*>(p_node->m_children[m_pos])->m_parent = this;
-
- node_with_children_base::splice(p_node, m_pos);
- }
     
     base_pointer detach(children_type::size_type m_pos)
     {
@@ -164,6 +156,13 @@
     
 };
 
+void splice(node_base* to, node_with_children_base*& from, node_with_children_base::children_type::size_type m_pos)
+{
+ static_cast<node_base*>(from)->m_parent = to;
+
+ splice(to->m_children[m_pos], from);
+}
+
 class descending_node_base
 : public node_with_children_base {
 };


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