$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: ockham_at_[hidden]
Date: 2008-08-19 09:00:34
Author: bernhard.reiter
Date: 2008-08-19 09:00:33 EDT (Tue, 19 Aug 2008)
New Revision: 48214
URL: http://svn.boost.org/trac/boost/changeset/48214
Log:
Some (rather cosmetic) *order algorithm fixes.
Text files modified: 
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/inorder.hpp   |    16 +++++++++++---                          
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/postorder.hpp |    43 +++++++++++++++++++++++++++------------ 
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/preorder.hpp  |    28 +++++++++++--------------               
   sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_tree_test.cpp              |     2                                         
   4 files changed, 55 insertions(+), 34 deletions(-)
Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/inorder.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/inorder.hpp	(original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/inorder.hpp	2008-08-19 09:00:33 EDT (Tue, 19 Aug 2008)
@@ -137,6 +137,8 @@
                         for_each_recursive(s, f);
                 f(*s);
         }
+	
+	// Multiway cursor
         if (!t.empty())
                 for_each_recursive(t, f);
 }
@@ -162,6 +164,8 @@
                         for_each_recursive(s, f);
                 f(*s);
         }
+	
+	// Multiway cursor
         if (!t.empty())
                 for_each_recursive(t, f);
         return f;
@@ -181,11 +185,13 @@
         s.to_begin();
         t.to_begin();
         
-	while (s!=r) {
+	for (; s != r; ++s, ++t) {
                 if (!s.empty())
                         copy(s, t);
-		*++t=*++s;
+		*t=*s;
         }
+	
+	// Multiway cursor
         if (!r.empty())
                 copy(r, t);
         return t;
@@ -212,11 +218,13 @@
         s.to_begin();
         t.to_begin();
         
-	while (s!=r) {
+	for (; s != r; ++s, ++t) {
                 if (!s.empty())
                         transform(s, t, op);
-		*++t=op(*++s);
+		*t=op(*s);
         }
+
+	// Multiway cursor
         if (!r.empty())
                 transform(r, t, op);
         return t;
Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/postorder.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/postorder.hpp	(original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/postorder.hpp	2008-08-19 09:00:33 EDT (Tue, 19 Aug 2008)
@@ -158,11 +158,14 @@
 void for_each_recursive(Cursor s, Op& f)
 {
         Cursor t = s;
-	s.to_begin();
-	do
+	for (s.to_begin(); s != t.end(); ++s)
                 if (!s.empty())
                         for_each_recursive(s, f);
-	while (s++ != t.end());
+
+	// Multiway cursor
+	if (!s.empty())
+		for_each_recursive(s, f);
+
         f(*t.to_begin());
 }
 
@@ -181,11 +184,14 @@
 Op for_each(Cursor s, Op f)
 {
         Cursor t = s;
-	s.to_begin();
-	do
+	for (s.to_begin(); s != t.end(); ++s)
                 if (!s.empty())
                         for_each_recursive(s, f);
-	while (s++ != t.end());
+
+	// Multiway cursor
+	if (!s.empty())
+		for_each_recursive(s, f);
+
         f(*t.to_begin());
 
         return f;
@@ -204,11 +210,18 @@
         InCursor r = s;
         s.to_begin();
         t.to_begin();
-	do {
+	
+	for (; s != r.end(); ++s, ++t) {
                 if (!s.empty())
                         copy(s, t);
-		++t;
-	} while (s++ != r.end());
+//		else
+//			*t = *s;
+	}
+	
+	// Multiway cursor
+	if (!s.empty())
+		copy(s, t);
+
         *t = *r.to_begin();
         return t;
 }
@@ -232,11 +245,15 @@
         InCursor r = s;
         s.to_begin();
         t.to_begin();
-	do {
+	
+	for (; s != r.end(); ++s, ++t)
                 if (!s.empty())
-			copy(s, t);
-		++t;
-	} while (s++ != r.end());
+			transform(s, t, op);
+
+	// Multiway cursor
+	if (!s.empty())
+		transform(s, t, op);
+	
         *t = op(*r.to_begin());
         return t;
 }
Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/preorder.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/preorder.hpp	(original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/preorder.hpp	2008-08-19 09:00:33 EDT (Tue, 19 Aug 2008)
@@ -155,14 +155,13 @@
 void for_each_recursive(Cursor s, Op& f)
 {
         Cursor t = s.end();
-	s.to_begin();
-	do {
+	for (s.to_begin(); s != t; ++s) {
                 f(*s);
                 if (!s.empty())
                         for_each_recursive(s, f);
-		++s;
-	} while (s != t);
+	}
         
+	// Multiway cursor
         if (!s.empty())
                 for_each_recursive(s, f);
 }
@@ -181,14 +180,13 @@
 Op for_each(Cursor s, Op f)
 {
         Cursor t = s.end();
-	s.to_begin();
-	do {
+	for (s.to_begin(); s != t; ++s) {
                 f(*s);
                 if (!s.empty())
                         for_each_recursive(s, f);
-		++s;
-	} while (s != t);
+	}
         
+	// Multiway cursor
         if (!s.empty())
                 for_each_recursive(s, f);
         
@@ -208,14 +206,13 @@
         s.to_begin();
         t.to_begin();
         
-	do {
+	for (; s != r; ++s, ++t) {
                 *t = *s;
                 if (!s.empty())
                         copy(s, t);
-		++t;
-		++s;
-	} while (s != r);
+	}
 
+	// Multiway cursor
         if (!r.empty())
                 copy(r, t);
 
@@ -241,14 +238,13 @@
         InCursor r = s.end();
         s.to_begin();
         t.to_begin();
-	do {
+	for (; s != r; ++s, ++t) {
                 *t = op(*s);
                 if (!s.empty())
                         transform(s, t, op);
-		++s;
-		++t;
-	} while (s != r);
+	}
 
+	// Multiway cursor
         if (!s.empty())
                 transform(s, t, op);
                 
Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_tree_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_tree_test.cpp	(original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_tree_test.cpp	2008-08-19 09:00:33 EDT (Tue, 19 Aug 2008)
@@ -96,7 +96,7 @@
         test::preorder::traversal(test_list.begin(), test_list.end());
         BOOST_CHECK(test_list.size() == 11);
         test_list.clear();
-	
+
         //test::preorder::algorithms(ft.root(), ft.root()); // FIXME: Fix algorithms for use in here.
         
         //boost::tree::postorder::copy(ft.root(), oc_test_list);