Boost logo

Boost-Commit :

From: ockham_at_[hidden]
Date: 2008-06-01 19:02:59


Author: bernhard.reiter
Date: 2008-06-01 19:02:59 EDT (Sun, 01 Jun 2008)
New Revision: 46034
URL: http://svn.boost.org/trac/boost/changeset/46034

Log:
Replace c = c.parent(); by c.to_parent(); (same for begin(), end()) in traversal algorithms.
Text files modified:
   sandbox/SOC/2006/tree/trunk/boost/tree/ascending.hpp | 2 +-
   sandbox/SOC/2006/tree/trunk/boost/tree/inorder.hpp | 23 ++++++++++-------------
   sandbox/SOC/2006/tree/trunk/boost/tree/postorder.hpp | 29 ++++++++++++++---------------
   sandbox/SOC/2006/tree/trunk/boost/tree/preorder.hpp | 20 ++++++++++----------
   4 files changed, 35 insertions(+), 39 deletions(-)

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/ascending.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/ascending.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/ascending.hpp 2008-06-01 19:02:59 EDT (Sun, 01 Jun 2008)
@@ -36,7 +36,7 @@
 template <class MultiwayCursor>
 inline void forward(MultiwayCursor& c)
 {
- c = c.parent();
+ c.to_parent();
         return;
 }
 

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/inorder.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/inorder.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/inorder.hpp 2008-06-01 19:02:59 EDT (Sun, 01 Jun 2008)
@@ -37,16 +37,14 @@
 inline void forward(MultiwayCursor& c)
 {
         if (!(++c).empty()) {
- while (!c.begin().empty())
- c = c.begin();
- c = c.begin();
+ while (!c.to_begin().empty());
                 return;
         }
         
         while (c.parity())
- c = c.parent();
+ c.to_parent();
         if (c.parent().begin() != c) // Root? Would be nice to get rid of.
- c = c.parent(); // Shoot (root's parent)
+ c.to_parent(); // Shoot (root's parent)
         return;
 }
 
@@ -70,14 +68,13 @@
 template <class MultiwayCursor>
 inline void back(MultiwayCursor& c)
 {
- if (!c.empty()) {
- while (!c.end().empty())
- c = c.end();
- c = c.begin();
+ if (!c.empty()) {
+ while (!c.to_end().empty());
+ --c;
                 return;
         }
         while (!c.parity())
- c = c.parent();
+ c.to_parent();
         --c;
         return;
 }
@@ -105,7 +102,7 @@
 {
         typename MultiwayTree::cursor c = t.root();
         while (!c.empty())
- c = c.begin();
+ c.to_begin();
         return c;
 }
 
@@ -120,7 +117,7 @@
 {
         typename MultiwayTree::const_cursor c = t.root();
         while (!c.empty())
- c = c.begin();
+ c.to_begin();
         return c;
 }
 
@@ -135,7 +132,7 @@
 {
         typename MultiwayTree::const_cursor c = t.root();
         while (!c.empty())
- c = c.begin();
+ c.to_begin();
         return c;
 }
 

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/postorder.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/postorder.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/postorder.hpp 2008-06-01 19:02:59 EDT (Sun, 01 Jun 2008)
@@ -32,7 +32,7 @@
 template <class Cursor>
 inline void forward(Cursor& c)
 {
- c = c.parent();
+ c.to_parent();
 
         if (c.parity()) { // Right child? Return parent.
                 --c;
@@ -45,7 +45,7 @@
         // Left child.
         ++c;
         while (!c.empty()) {
- c = c.begin();
+ c.to_begin();
                 if (c.empty())
                         ++c;
         }
@@ -74,28 +74,27 @@
 inline void back(Cursor& c)
 {
         if (!c.parity() && (c.parent().begin() != c)) { // Root?
- c = c.begin();
+ c.to_begin();
                 return;
         }
         if (!(++c).empty()) { // Right
- c = c.begin();
+ c.to_begin();
                 return;
         }
         if (!(--c).empty()) { // Left
- c = c.begin();
+ c.to_begin();
                 return;
         }
         
         while (true) { // revisit
- c = c.parent();
- if (c.parity())
- if (!(--c).empty()) {
- c = c.begin();
- return;
- }
+ c.to_parent();
+ if (c.parity())
+ if (!(--c).empty()) {
+ c.to_begin();
+ return;
+ }
         }
         return;
-
 }
 
 /**
@@ -121,7 +120,7 @@
 {
         typename Tree::cursor c = t.root();
         while (!c.empty())
- c = c.begin();
+ c.to_begin();
         return c;
 }
 
@@ -136,7 +135,7 @@
 {
         typename Tree::const_cursor c = t.root();
         while (!c.empty())
- c = c.begin();
+ c.to_begin();
         return c;
 }
 
@@ -151,7 +150,7 @@
 {
         typename Tree::const_cursor c = t.root();
         while (!c.empty())
- c = c.begin();
+ c.to_begin();
         return c;
 }
 

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/preorder.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/preorder.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/preorder.hpp 2008-06-01 19:02:59 EDT (Sun, 01 Jun 2008)
@@ -33,24 +33,24 @@
 inline void forward(Cursor& c)
 {
         if (!c.empty()) { // Left.
- c = c.begin();
+ c.to_begin();
                 return;
         }
         if (!(++c).empty()) { // Right.
- c = c.begin();
+ c.to_begin();
                 return;
         }
 
         while (c.parity())
- c = c.parent();
+ c.to_parent();
         if (!(++c).empty()) {
- c = c.begin();
+ c.to_begin();
                 return;
         }
         
         --c;
         while (!c.empty()) {
- c = c.end();
+ c.to_end();
                 if (c.empty())
                         --c;
         }
@@ -78,11 +78,11 @@
 template <class Cursor>
 inline void back(Cursor& c)
 {
- c = c.parent();
+ c.to_parent();
         if (c.parity()) {
                 --c;
                 while (!c.empty())
- c = c.end();
+ c.to_end();
                 return;
         }
         return;
@@ -147,7 +147,7 @@
         typename Tree::cursor c = t.shoot();
         --c;
         while (!c.empty()) {
- c = c.end();
+ c.to_end();
                 if (c.empty())
                         --c;
         }
@@ -167,7 +167,7 @@
         typename Tree::const_cursor c = t.cshoot();
         --c;
         while (!c.empty()) {
- c = c.end();
+ c.to_end();
                 if (c.empty())
                         --c;
         }
@@ -187,7 +187,7 @@
         typename Tree::const_cursor c = t.cshoot();
         --c;
         while (!c.empty()) {
- c = c.end();
+ c.to_end();
                 if (c.empty())
                         --c;
         }


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