Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51781 - in sandbox/SOC/2006/tree/trunk: . boost/tree libs/tree/test
From: ockham_at_[hidden]
Date: 2009-03-15 03:50:20


Author: bernhard.reiter
Date: 2009-03-15 03:50:19 EDT (Sun, 15 Mar 2009)
New Revision: 51781
URL: http://svn.boost.org/trac/boost/changeset/51781

Log:
{left|right}most fixes
Text files modified:
   sandbox/SOC/2006/tree/trunk/TODO | 4 ++++
   sandbox/SOC/2006/tree/trunk/boost/tree/algorithm.hpp | 2 +-
   sandbox/SOC/2006/tree/trunk/boost/tree/forest.hpp | 3 +--
   sandbox/SOC/2006/tree/trunk/boost/tree/general_algorithms.hpp | 10 ++++++----
   sandbox/SOC/2006/tree/trunk/boost/tree/inorder_algorithms.hpp | 4 ++--
   sandbox/SOC/2006/tree/trunk/libs/tree/test/predecessor_test.cpp | 2 +-
   sandbox/SOC/2006/tree/trunk/libs/tree/test/successor_test.cpp | 2 +-
   7 files changed, 16 insertions(+), 11 deletions(-)

Modified: sandbox/SOC/2006/tree/trunk/TODO
==============================================================================
--- sandbox/SOC/2006/tree/trunk/TODO (original)
+++ sandbox/SOC/2006/tree/trunk/TODO 2009-03-15 03:50:19 EDT (Sun, 15 Mar 2009)
@@ -14,6 +14,10 @@
 [section TODO]
 
 General:
+* Do we need to_{left|right}most_ancestor?
+* Do we need multiway and plain cursor "flavor" tags (for algorithms)?
+* Add a (horizontal) reverse_cursor adaptor
+* Fix cursor archetype
 * In case of forest cursor, is_leaf() should really be empty().
 * Further reduce test data redundancy: make mock cursor use the data from fake_binary_tree,
   and give it an Order template argument. Calculate *order positions from level order indices

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/algorithm.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/algorithm.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/algorithm.hpp 2009-03-15 03:50:19 EDT (Sun, 15 Mar 2009)
@@ -102,7 +102,7 @@
     (void)) // return type
 to_forest_end(BinaryCursor& c)
 {
- rightmost(c.to_begin());
+ to_rightmost(c.to_begin());
 }
 
 //template <class BinaryCursor>

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/forest.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/forest.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/forest.hpp 2009-03-15 03:50:19 EDT (Sun, 15 Mar 2009)
@@ -125,8 +125,7 @@
     cursor end()
     {
         base_cursor b(h.root());
- while (!b.is_leaf())
- b.to_end();
+ to_rightmost(b);
         return cursor(b);
     }
 

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/general_algorithms.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/general_algorithms.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/general_algorithms.hpp 2009-03-15 03:50:19 EDT (Sun, 15 Mar 2009)
@@ -31,9 +31,10 @@
 BOOST_CONCEPT_REQUIRES(
     ((DescendingCursor<Cursor>)),
     (void)) // return type
-leftmost(Cursor& c)
+to_leftmost(Cursor& c)
 {
- while (!c.to_begin().is_leaf());
+ while (!c.is_leaf())
+ c.to_begin();
 }
 
 /**
@@ -46,9 +47,10 @@
 BOOST_CONCEPT_REQUIRES(
     ((DescendingCursor<Cursor>)),
     (void)) // return type
-rightmost(Cursor& c)
+to_rightmost(Cursor& c)
 {
- while (!c.to_end().is_leaf());
+ while (!c.is_leaf())
+ c.to_end();
 }
 
 // These algorithms are actually mostly preorder, as it's most efficient, but I

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/inorder_algorithms.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/inorder_algorithms.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/inorder_algorithms.hpp 2009-03-15 03:50:19 EDT (Sun, 15 Mar 2009)
@@ -47,7 +47,7 @@
 successor(inorder, MultiwayCursor& c)
 {
     if (!(++c).is_leaf()) {
- leftmost(c);
+ to_leftmost(c);
         return;
     }
     
@@ -69,7 +69,7 @@
 predecessor(inorder, MultiwayCursor& c)
 {
     if (!c.is_leaf()) {
- rightmost(c);
+ to_rightmost(c);
         --c;
         return;
     }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/predecessor_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/predecessor_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/predecessor_test.cpp 2009-03-15 03:50:19 EDT (Sun, 15 Mar 2009)
@@ -22,7 +22,7 @@
 BOOST_AUTO_TEST_CASE( test_rightmost )
 {
     fake_binary_tree<int>::root_tracking_cursor c = fbt1.root_tracking_root(); //.begin();
- rightmost(c);
+ to_rightmost(c);
     BOOST_CHECK_EQUAL(*c, 14);
 }
 

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/successor_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/successor_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/successor_test.cpp 2009-03-15 03:50:19 EDT (Sun, 15 Mar 2009)
@@ -20,7 +20,7 @@
 BOOST_AUTO_TEST_CASE( test_leftmost )
 {
     fake_binary_tree<int>::root_tracking_cursor c = fbt1.root_tracking_root(); //.begin();
- leftmost(c);
+ to_leftmost(c);
     BOOST_CHECK_EQUAL(*c, 1);
 }
 


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