Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53302 - in sandbox/SOC/2006/tree/trunk: . boost/tree boost/tree/detail libs/tree/test
From: ockham_at_[hidden]
Date: 2009-05-27 10:02:16


Author: bernhard.reiter
Date: 2009-05-27 10:02:13 EDT (Wed, 27 May 2009)
New Revision: 53302
URL: http://svn.boost.org/trac/boost/changeset/53302

Log:
More fake tree.
Some first experiments for subforest algorithms (preorder for_each, successor).
Text files modified:
   sandbox/SOC/2006/tree/trunk/TODO | 2
   sandbox/SOC/2006/tree/trunk/boost/tree/algorithm.hpp | 21 ++++++++++
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/forest_cursor.hpp | 18 ++++++++
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/iterative_algorithms.hpp | 23 ++++++++--
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/recursive_preorder_algorithms.hpp | 39 ++++++++++++++++++
   sandbox/SOC/2006/tree/trunk/boost/tree/forest.hpp | 2
   sandbox/SOC/2006/tree/trunk/boost/tree/preorder_algorithms.hpp | 41 +++++++++++++++++++
   sandbox/SOC/2006/tree/trunk/libs/tree/test/copy_test.cpp | 7 +-
   sandbox/SOC/2006/tree/trunk/libs/tree/test/fake_binary_tree.hpp | 84 ++++++++++++++++++++++++++++++++++++---
   sandbox/SOC/2006/tree/trunk/libs/tree/test/for_each_test.cpp | 78 ++++++++++++++++++++++++++++++++++++
   sandbox/SOC/2006/tree/trunk/libs/tree/test/predecessor_test.cpp | 8 ++-
   sandbox/SOC/2006/tree/trunk/libs/tree/test/successor_test.cpp | 11 +++-
   sandbox/SOC/2006/tree/trunk/libs/tree/test/to_last_test.cpp | 3
   sandbox/SOC/2006/tree/trunk/libs/tree/test/transform_test.cpp | 5 +
   14 files changed, 312 insertions(+), 30 deletions(-)

Modified: sandbox/SOC/2006/tree/trunk/TODO
==============================================================================
--- sandbox/SOC/2006/tree/trunk/TODO (original)
+++ sandbox/SOC/2006/tree/trunk/TODO 2009-05-27 10:02:13 EDT (Wed, 27 May 2009)
@@ -14,6 +14,8 @@
 [section TODO]
 
 General:
+* Subforest algorithms: with a first and last parameter (which, for binary tree based
+ forests, should be passed through to the corresponding binary cursor algorithms.
 * Do we need to_{left|right}most_ancestor?
 * Do we need multiway and plain cursor "flavor" tags (for algorithms)?
 * In case of forest cursor, is_leaf() should really be empty().

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-05-27 10:02:13 EDT (Wed, 27 May 2009)
@@ -149,6 +149,27 @@
 }
 
 /**
+ * @brief Apply a function to every element of a subforest,
+ * in the order specified by the first parameter.
+ * @param s A cursor.
+ * @param t A cursor.
+ * @param f A unary function object.
+ * @return @p f
+ *
+ * Applies the function object @p f to each element in the @p subforest
+ * given by the range spanned by the s and t cursor arguments.
+ * @p f must not modify the order of the sequence.
+ * If @p f has a return value it is ignored.
+ */
+//template <class Order, class Cursor, class Op>
+//Op for_each(Order, Cursor s, Cursor t, Op f)
+//{
+// return detail::for_each(Order(), s, t, f
+// , typename cursor_vertical_traversal<Cursor>::type());
+//}
+//
+
+/**
  * @brief Performs an operation on a subtree, by traversing it
  * in the order specified by the first parameter.
  * @param s An input cursor.

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/forest_cursor.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/forest_cursor.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/forest_cursor.hpp 2009-05-27 10:02:13 EDT (Wed, 27 May 2009)
@@ -14,7 +14,8 @@
 
 #include <boost/tree/cursor.hpp>
 #include <boost/tree/cursor_adaptor.hpp>
-//#include <boost/tree/inorder_algorithms.hpp>
+
+#include <boost/tree/detail/iterative_algorithms.hpp>
 
 #include <boost/type_traits/is_convertible.hpp>
 #include <boost/utility/enable_if.hpp>
@@ -128,6 +129,21 @@
 };
 
 } // namespace detail
+
+template <class BinaryCursor, class Op>
+Op for_each(preorder, boost::tree::detail::forest_cursor<BinaryCursor> s, boost::tree::detail::forest_cursor<BinaryCursor> t, Op f)
+{
+ return detail::for_each(preorder(), s.base(), t.base(), f
+ , typename cursor_vertical_traversal<BinaryCursor>::type());
+}
+
+template <class BinaryCursor, class Op>
+Op for_each(postorder, boost::tree::detail::forest_cursor<BinaryCursor> s, boost::tree::detail::forest_cursor<BinaryCursor> t, Op f)
+{
+ return detail::for_each(inorder(), s.base(), t.base(), f
+ , typename cursor_vertical_traversal<BinaryCursor>::type());
+}
+
 } // namespace tree
 } // namespace boost
 

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/iterative_algorithms.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/iterative_algorithms.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/iterative_algorithms.hpp 2009-05-27 10:02:13 EDT (Wed, 27 May 2009)
@@ -28,17 +28,14 @@
 namespace tree {
 namespace detail {
 
+// .base() !!!
 template <class Order, class Cursor, class Op>
 BOOST_CONCEPT_REQUIRES(
     ((DescendingCursor<Cursor>))
- ((AscendingCursor<Cursor>)),
+ ((AscendingCursor<Cursor>)), // FIXME: Also RootTrackingCursor?
     (Op)) // return type
-for_each(Order, Cursor is, Op f, ascending_vertical_traversal_tag)
+for_each(Order, Cursor s, Cursor s2, Op f, ascending_vertical_traversal_tag)
 {
- root_tracking_cursor<Cursor> s(is);
- root_tracking_cursor<Cursor> s2(s);
- to_first(Order(), s);
- to_last(Order(), s2);
     while (s!=s2) {
         f(*s);
         successor(Order(), s);
@@ -46,6 +43,20 @@
     return f;
 }
 
+template <class Order, class Cursor, class Op>
+BOOST_CONCEPT_REQUIRES(
+ ((DescendingCursor<Cursor>))
+ ((AscendingCursor<Cursor>)),
+ (Op)) // return type
+for_each(Order, Cursor is, Op f, ascending_vertical_traversal_tag)
+{
+ root_tracking_cursor<Cursor> s(is);
+ root_tracking_cursor<Cursor> s2(is);
+ to_first(Order(), s);
+ to_last(Order(), s2);
+ return detail::for_each(Order(), s, s2, f, ascending_vertical_traversal_tag());
+}
+
 template <class Order, class InCursor, class OutCursor, class Op>
 BOOST_CONCEPT_REQUIRES(
     ((DescendingCursor<InCursor>))

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/recursive_preorder_algorithms.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/recursive_preorder_algorithms.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/recursive_preorder_algorithms.hpp 2009-05-27 10:02:13 EDT (Wed, 27 May 2009)
@@ -24,6 +24,24 @@
 
 //#ifdef BOOST_RECURSIVE_ORDER_ALGORITHMS
 
+template <class Cursor, class Op>
+BOOST_CONCEPT_REQUIRES(
+ ((DescendingCursor<Cursor>)),
+ (void)) // return type
+for_each_recursive(preorder, Cursor s, Cursor t2, Op& f)
+{
+ Cursor t = s.end();
+ for (s.to_begin(); s != t; ++s) {
+ f(*s);
+ if (!s.is_leaf() || s == t2)
+ for_each_recursive(preorder(), s, t2, f);
+ }
+
+ // Multiway cursor
+ if (!s.is_leaf() || s == t2)
+ for_each_recursive(preorder(), s, t2, f);
+}
+
 /**
  * @if maint
  * Helper function for for_each, using a reference parameter in order to
@@ -48,6 +66,27 @@
         for_each_recursive(preorder(), s, f);
 }
 
+template <class Cursor, class Op>
+BOOST_CONCEPT_REQUIRES(
+ ((DescendingCursor<Cursor>)),
+ (Op)) // return type
+for_each(preorder, Cursor s, Cursor t2, Op f, descending_vertical_traversal_tag)
+{
+ Cursor t = s.end();
+ --t2; // Bit tweaky.
+ for (s.to_begin(); s != t ; ++s) {
+ f(*s);
+ if (!s.is_leaf() || s == t2)
+ for_each_recursive(preorder(), s, t2, f);
+ }
+
+ // Multiway cursor
+ if (!s.is_leaf() || s == t2)
+ for_each_recursive(preorder(), s, t2, f);
+
+ return f;
+}
+
 /**
  * @brief Apply a function to every element of a subtree, in preorder.
  * @param s A cursor.

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-05-27 10:02:13 EDT (Wed, 27 May 2009)
@@ -156,7 +156,7 @@
      */
     cursor insert(cursor pos, value_type const& val)
     {
- return cursor(h.insert(base_cursor(pos), val));
+ return cursor(h.insert(pos.base(), val));
     }
 
     /**

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/preorder_algorithms.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/preorder_algorithms.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/preorder_algorithms.hpp 2009-05-27 10:02:13 EDT (Wed, 27 May 2009)
@@ -72,6 +72,47 @@
 }
 
 /**
+ * @brief Preorder successor
+ * @param c Cursor to be set to its preorder successor
+ */
+template <typename Cursor>
+inline
+BOOST_CONCEPT_REQUIRES(
+ ((DescendingCursor<Cursor>))
+ ((RootTrackingCursor<Cursor>)),
+ (void)) // return type
+successor(preorder, Cursor& c, Cursor& r)
+{
+ // If we have a left child, go there.
+ if (!c.is_leaf()) {
+ c.to_begin();
+ return;
+ }
+
+ // No left child. So if we have a right child, go there.
+ if (!(++c).is_leaf()) {
+ c.to_begin();
+ return;
+ }
+
+ // (Here's where we'd need to check if this is the end().)
+
+ // No children at all.
+ // As we've already visited all the ancestors, we'll move upwards until
+ // we find an ancestor that has a right child.
+ while (!c.is_root()) { // Doesn't work with subtrees!
+ c.to_parent();
+ if (!c.is_root() && !index(c)) {
+ if (!(++c).is_leaf()) {
+ c.to_begin();
+ return;
+ }
+ }
+ }
+ return;
+}
+
+/**
  * @brief Preorder predecessor
  * @param c Cursor to be set to its preorder predecessor
  */

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/copy_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/copy_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/copy_test.cpp 2009-05-27 10:02:13 EDT (Wed, 27 May 2009)
@@ -32,7 +32,7 @@
     typename container_type::const_iterator cie = order_index.end();
     mock_binary_cursor< typename container_type::const_iterator > mc(ci, cie);
 
- boost::tree::copy(Order(), fbt1.descending_root(), mc);
+ boost::tree::copy(Order(), fbt1.root(), mc);
 }
 
 BOOST_AUTO_TEST_CASE_TEMPLATE( test_copy_ascending, Order, orders )
@@ -46,8 +46,9 @@
     typename container_type::const_iterator ci = order_index.begin();
     typename container_type::const_iterator cie = order_index.end();
     mock_binary_cursor< typename container_type::const_iterator > mc(ci, cie);
-
- boost::tree::copy(Order(), fbt1.ascending_root(), mc);
+
+ fake_binary_tree<int, boost::tree::ascending_vertical_traversal_tag> fabt1(fbt1);
+ boost::tree::copy(Order(), fabt1.root(), mc);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/fake_binary_tree.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/fake_binary_tree.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/fake_binary_tree.hpp 2009-05-27 10:02:13 EDT (Wed, 27 May 2009)
@@ -23,9 +23,15 @@
 template <class T>
 struct fake_root_tracking_binary_cursor;
 
+using boost::tree::descending_vertical_traversal_tag;
+using boost::tree::ascending_vertical_traversal_tag;
+
+template <class T, class VT = descending_vertical_traversal_tag>
+struct fake_binary_tree;
+
 /// See http://en.wikipedia.org/wiki/Binary_Tree#Methods_for_storing_binary_trees
 template <class T>
-struct fake_binary_tree {
+struct fake_binary_tree<T, descending_vertical_traversal_tag> {
     typedef std::vector<T> children_type;
     typedef typename children_type::size_type size_type;
     typedef typename children_type::value_type value_type;
@@ -38,13 +44,15 @@
 
     typedef descending_cursor cursor;
     typedef const_descending_cursor const_cursor;
-
+
+protected:
     typedef fake_ascending_binary_cursor<T> ascending_cursor;
- typedef fake_ascending_binary_cursor<T const> const_ascending_cursor;
+ typedef fake_ascending_binary_cursor<T> const_ascending_cursor; //FIXME
 
     typedef fake_root_tracking_binary_cursor<T> root_tracking_cursor;
- typedef fake_root_tracking_binary_cursor<T const> const_root_tracking_cursor;
-
+ typedef fake_root_tracking_binary_cursor<T> const_root_tracking_cursor; //FIXME
+
+public:
     fake_binary_tree(size_type s = 0) : m_data(s)
     { }
     
@@ -63,16 +71,28 @@
         return const_descending_cursor(*this, 0);
     }
 
+protected:
     ascending_cursor ascending_root()
     {
         return ascending_cursor(*this, 0);
     }
 
+ const_ascending_cursor ascending_root() const
+ {
+ return const_ascending_cursor(*this, 0);
+ }
+
     root_tracking_cursor root_tracking_root()
     {
         return root_tracking_cursor(*this, 0);
     }
 
+ const_root_tracking_cursor root_tracking_root() const
+ {
+ return const_root_tracking_cursor(*this, 0);
+ }
+
+public:
     descending_cursor insert(descending_cursor c, value_type const& v)
     {
         if (c.m_pos >= m_data.size())
@@ -114,13 +134,61 @@
 };
 
 template <class T>
-bool operator==(fake_binary_tree<T> const& x, fake_binary_tree<T> const& y)
+struct fake_binary_tree<T, ascending_vertical_traversal_tag>
+: fake_binary_tree<T, descending_vertical_traversal_tag> {
+ typedef typename fake_binary_tree<T>::size_type size_type;
+ typedef typename fake_binary_tree<T>::ascending_cursor cursor;
+ typedef typename fake_binary_tree<T>::const_ascending_cursor const_cursor;
+
+ fake_binary_tree(size_type s = 0)
+ : fake_binary_tree<T, descending_vertical_traversal_tag>(s) { }
+
+ fake_binary_tree(fake_binary_tree<T, descending_vertical_traversal_tag> const& f)
+ : fake_binary_tree<T, descending_vertical_traversal_tag>(f) { }
+
+ cursor root()
+ {
+ return fake_binary_tree<T, descending_vertical_traversal_tag>::ascending_root();
+ }
+
+ const_cursor root() const
+ {
+ return fake_binary_tree<T, descending_vertical_traversal_tag>::ascending_root();
+ }
+};
+
+template <class T>
+struct fake_root_tracking_binary_tree
+: fake_binary_tree<T, descending_vertical_traversal_tag> {
+ typedef typename fake_binary_tree<T>::size_type size_type;
+ typedef typename fake_binary_tree<T>::root_tracking_cursor cursor;
+ typedef typename fake_binary_tree<T>::const_root_tracking_cursor const_cursor;
+
+ fake_root_tracking_binary_tree(size_type s = 0)
+ : fake_binary_tree<T, descending_vertical_traversal_tag>(s) { }
+
+ fake_root_tracking_binary_tree(fake_binary_tree<T, descending_vertical_traversal_tag> const& f)
+ : fake_binary_tree<T, descending_vertical_traversal_tag>(f) { }
+
+ cursor root()
+ {
+ return fake_binary_tree<T, descending_vertical_traversal_tag>::root_tracking_root();
+ }
+
+ const_cursor root() const
+ {
+ return fake_binary_tree<T, descending_vertical_traversal_tag>::root_tracking_root();
+ }
+};
+
+template <class T, class VT>
+bool operator==(fake_binary_tree<T, VT> const& x, fake_binary_tree<T, VT> const& y)
 {
     return (x.m_data == y.m_data);
 }
 
-template <class T>
-bool operator!=(fake_binary_tree<T> const& x, fake_binary_tree<T> const& y)
+template <class T, class VT>
+bool operator!=(fake_binary_tree<T, VT> const& x, fake_binary_tree<T, VT> const& y)
 {
     return !(x == y);
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/for_each_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/for_each_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/for_each_test.cpp 2009-05-27 10:02:13 EDT (Wed, 27 May 2009)
@@ -8,6 +8,8 @@
 
 #include <boost/lambda/bind.hpp>
 
+#include <boost/tree/forest.hpp>
+
 #define BOOST_TEST_MODULE cursor_algorithm test
 #include <boost/test/included/unit_test.hpp>
 #include <boost/test/test_case_template.hpp>
@@ -73,12 +75,86 @@
     typename container_type::const_iterator ci = order_index.begin();
     typename container_type::const_iterator cie = order_index.end();
 
+ fake_binary_tree<int, boost::tree::ascending_vertical_traversal_tag> fabt1(fbt1);
+
     mock_unary_functor<typename container_type::const_iterator> muc(ci, cie);
     boost::tree::for_each(
         Order(),
- fbt1.ascending_root(),
+ fabt1.root(),
         muc
     );
 }
 
+BOOST_AUTO_TEST_CASE( test_forest_for_each_descending_preorder)
+{
+ test_data_set mpo;
+ mock_cursor_data(mpo);
+
+ typedef test_data_set::index<preorder>::type container_type;
+ const container_type& order_index = mpo.get<preorder>();
+
+ container_type::const_iterator ci = order_index.begin();
+ container_type::const_iterator cie = order_index.end();
+ ++ci; // 3
+ cie = ci;
+ ++++++++cie; // 7
+
+ boost::tree::forest<int, fake_binary_tree<int> > ft0(fbt1);
+
+ mock_unary_functor<container_type::const_iterator> muc(ci, cie);
+ //FIXME:
+// boost::tree::for_each(
+// preorder(),
+// ft0.begin().begin(),
+// ft0.begin().end(),
+// muc
+// );
+}
+
+BOOST_AUTO_TEST_CASE( test_forest_for_each_ascending_preorder)
+{
+ test_data_set mpo;
+ mock_cursor_data(mpo);
+
+ typedef test_data_set::index<preorder>::type container_type;
+ const container_type& order_index = mpo.get<preorder>();
+
+ container_type::const_iterator ci = order_index.begin();
+ container_type::const_iterator cie = order_index.end();
+ ++ci; // 3
+ cie = ci;
+ ++++++++cie; // 7
+
+ fake_root_tracking_binary_tree<int> fabt1(fbt1);
+ boost::tree::forest<int, fake_root_tracking_binary_tree<int> > ft0(fabt1);
+
+ mock_unary_functor<container_type::const_iterator> muc(ci, cie);
+// boost::tree::for_each(
+// preorder(),
+// ft0.begin().begin().begin(), //boost::tree::detail::forest_cursor< fake_ascending_binary_cursor<int> >(fabt1.root().begin().begin()), //Shouldn't that just be one begin()?
+// ft0.begin().end(), //boost::tree::detail::forest_cursor< fake_ascending_binary_cursor<int> >(fabt1.root().begin().end().end().begin()),
+// muc
+// );
+
+ //boost::tree::detail::forest_cursor< fake_root_tracking_binary_cursor<int> > dfc0(ft0.begin().begin().end());
+
+ // Also try ft0.begin and ft0.end consistency!
+
+ fake_root_tracking_binary_cursor<int> dfc(ft0.begin().begin().begin().base()); //(fabt1.root().begin().begin());
+ fake_root_tracking_binary_cursor<int> dfce(ft0.begin().end().base());
+ --dfce;
+ BOOST_CHECK_EQUAL(*dfce, 7);
+
+ BOOST_CHECK_EQUAL(*dfc, ci->val);
+ successor(preorder(), dfc);
+ BOOST_CHECK_EQUAL(*dfc, (++ci)->val);
+ successor(preorder(), dfc);
+ BOOST_CHECK_EQUAL(*dfc, 6);
+ successor(preorder(), dfc);
+ BOOST_CHECK_EQUAL(*dfc, 4);
+ successor(preorder(), dfc);
+ BOOST_CHECK_EQUAL(*dfc, 7);
+ BOOST_CHECK(dfc == dfce);
+}
+
 BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file

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-05-27 10:02:13 EDT (Wed, 27 May 2009)
@@ -21,15 +21,17 @@
 
 BOOST_AUTO_TEST_CASE( test_rightmost )
 {
- fake_binary_tree<int>::root_tracking_cursor c = fbt1.root_tracking_root();
+ fake_root_tracking_binary_tree<int> frbt1(fbt1);
+ fake_root_tracking_binary_tree<int>::cursor c = frbt1.root();
     to_rightmost(c);
     BOOST_CHECK(c.is_leaf());
- BOOST_CHECK(c == fbt1.root_tracking_root().end().end().end());
+ BOOST_CHECK(c == frbt1.root().end().end().end());
 }
 
 BOOST_AUTO_TEST_CASE_TEMPLATE( test_predecessor, Order, orders )
 {
- fake_binary_tree<int>::root_tracking_cursor c = fbt1.root_tracking_root();
+ fake_root_tracking_binary_tree<int> frbt1(fbt1);
+ fake_root_tracking_binary_tree<int>::cursor c = frbt1.root();
     to_last(Order(), c);
     // Replace by a fake_to_last function for dependency minimization's sake?
     // preorder: fbt1.root_tracking_root().end().end().begin().begin().end().begin();

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-05-27 10:02:13 EDT (Wed, 27 May 2009)
@@ -19,15 +19,17 @@
 
 BOOST_AUTO_TEST_CASE( test_leftmost )
 {
- fake_binary_tree<int>::root_tracking_cursor c = fbt1.root_tracking_root();
+ fake_root_tracking_binary_tree<int> frbt1(fbt1);
+ fake_root_tracking_binary_tree<int>::cursor c = frbt1.root();
     to_leftmost(c);
     BOOST_CHECK(c.is_leaf());
- BOOST_CHECK(c == fbt1.root_tracking_root().begin().begin().begin());
+ BOOST_CHECK(c == frbt1.root().begin().begin().begin());
 }
 
 BOOST_AUTO_TEST_CASE_TEMPLATE( test_successor, Order, orders )
 {
- fake_binary_tree<int>::root_tracking_cursor c = fbt1.root_tracking_root();
+ fake_root_tracking_binary_tree<int> frbt1(fbt1);
+ fake_root_tracking_binary_tree<int>::cursor c = frbt1.root();
     to_first(Order(), c);
     // Replace by a fake_to_first function for dependency minimization's sake?
     // preorder: fbt1.root_tracking_root().begin();
@@ -50,7 +52,8 @@
 
 BOOST_AUTO_TEST_CASE( test_successor_ascending )
 {
- fake_binary_tree<int>::ascending_cursor c = fbt1.ascending_root();
+ fake_binary_tree<int, boost::tree::ascending_vertical_traversal_tag> fabt1(fbt1);
+ fake_binary_tree<int, boost::tree::ascending_vertical_traversal_tag>::cursor c = fabt1.root();
     c.to_begin().to_end().to_begin().to_begin();
     BOOST_CHECK_EQUAL(*c, 4);
     boost::tree::successor(ascending(), c);

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/to_last_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/to_last_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/to_last_test.cpp 2009-05-27 10:02:13 EDT (Wed, 27 May 2009)
@@ -26,7 +26,8 @@
     = mpo.get<Order>().end();
     --cie;
 
- fake_binary_tree<int>::root_tracking_cursor c = fbt1.root_tracking_root();
+ fake_root_tracking_binary_tree<int> frbt1(fbt1);
+ fake_root_tracking_binary_tree<int>::cursor c = frbt1.root();
     boost::tree::to_last(Order(), c);
     boost::tree::predecessor(Order(), c);
     BOOST_CHECK_EQUAL(*c, cie->val);

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/transform_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/transform_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/transform_test.cpp 2009-05-27 10:02:13 EDT (Wed, 27 May 2009)
@@ -34,7 +34,7 @@
     typename container_type::const_iterator cie = order_index.end();
     mock_binary_cursor< typename container_type::const_iterator > mc(ci, cie);
     
- boost::tree::transform(Order(), fbt1.descending_root(), mc, std::bind2nd(std::plus<int>(),0));
+ boost::tree::transform(Order(), fbt1.root(), mc, std::bind2nd(std::plus<int>(),0));
 }
 
 BOOST_AUTO_TEST_CASE_TEMPLATE( test_transform_ascending, Order, orders)
@@ -49,7 +49,8 @@
     typename container_type::const_iterator cie = order_index.end();
     mock_binary_cursor< typename container_type::const_iterator > mc(ci, cie);
     
- boost::tree::transform(Order(), fbt1.ascending_root(), mc, std::bind2nd(std::plus<int>(),0));
+ fake_binary_tree<int, boost::tree::ascending_vertical_traversal_tag> fabt1(fbt1);
+ boost::tree::transform(Order(), fabt1.root(), mc, std::bind2nd(std::plus<int>(),0));
 }
 
 BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file


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