Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49007 - in sandbox/SOC/2006/tree/trunk: . boost/tree boost/tree/detail/algorithm/cursor boost/tree/detail/cursor
From: ockham_at_[hidden]
Date: 2008-09-29 11:35:43


Author: bernhard.reiter
Date: 2008-09-29 11:35:42 EDT (Mon, 29 Sep 2008)
New Revision: 49007
URL: http://svn.boost.org/trac/boost/changeset/49007

Log:
Fix output iterator cursor wrapper.
Text files modified:
   sandbox/SOC/2006/tree/trunk/TODO | 2
   sandbox/SOC/2006/tree/trunk/boost/tree/ascending_cursor.hpp | 40 +++++++-------
   sandbox/SOC/2006/tree/trunk/boost/tree/cursor.hpp | 70 +++++++++++++++++++++++-
   sandbox/SOC/2006/tree/trunk/boost/tree/cursor_adaptor.hpp | 113 +++++++++++++++++++--------------------
   sandbox/SOC/2006/tree/trunk/boost/tree/cursor_facade.hpp | 70 ++++++++++++------------
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/_order_iterative.hpp | 31 +++++++++-
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/inorder.hpp | 10 ++-
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/postorder.hpp | 10 ++-
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/preorder.hpp | 10 ++-
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/cursor/nary.hpp | 12 ++--
   sandbox/SOC/2006/tree/trunk/boost/tree/root_tracking_cursor.hpp | 107 +++++++++++++++++++++++++++++++++++--
   11 files changed, 331 insertions(+), 144 deletions(-)

Modified: sandbox/SOC/2006/tree/trunk/TODO
==============================================================================
--- sandbox/SOC/2006/tree/trunk/TODO (original)
+++ sandbox/SOC/2006/tree/trunk/TODO 2008-09-29 11:35:42 EDT (Mon, 29 Sep 2008)
@@ -15,6 +15,8 @@
 
 General:
 
+* Test cursor adaptors wrapped around output cursors!
+* Add tests for *order::copy involving a seond tree cursor (not just a cursor adaptor).
 * Think of a couple good examples (draw inspiration eg from Wikipedia: Tree traversal
   or CRLS) and include them in the docs. Maybe move some files from libs/test to
   example.

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/ascending_cursor.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/ascending_cursor.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/ascending_cursor.hpp 2008-09-29 11:35:42 EDT (Mon, 29 Sep 2008)
@@ -40,23 +40,23 @@
 
 template <class DescendingCursor>
 class ascending_cursor
- : public cursor_facade<ascending_cursor<DescendingCursor>
+: public cursor_facade<ascending_cursor<DescendingCursor>
       , typename cursor_value<DescendingCursor>::type
       , random_access_traversal_tag
       , bidirectional_traversal_tag
> {
- private:
+private:
     struct enabler {};
     typedef ascending_cursor<DescendingCursor> self_type;
- public:
- typedef typename DescendingCursor::value_type value_type;
+public:
+ typedef typename DescendingCursor::value_type value_type;
 
     // Container-specific:
     typedef typename DescendingCursor::size_type size_type;
 
     // DescendingCursor-specific
- typedef ascending_cursor<DescendingCursor> cursor;
- typedef ascending_cursor<typename DescendingCursor::const_cursor> const_cursor;
+ typedef ascending_cursor<DescendingCursor> cursor;
+ typedef ascending_cursor<typename DescendingCursor::const_cursor> const_cursor;
     
     // Container-specific:
     typedef cursor iterator;
@@ -68,7 +68,7 @@
     };
     
     ascending_cursor()
- : m_s() {}
+ : m_s() {}
 
     explicit ascending_cursor(DescendingCursor c)
     {
@@ -105,7 +105,7 @@
 
  private:
 
- friend class boost::iterator_core_access;
+ friend class boost::iterator_core_access;
     friend class boost::tree::cursor_core_access;
     
     friend class root_tracking_cursor<self_type>;
@@ -116,7 +116,7 @@
 // boost::tree::ascending::iterator<self_type>
 // , boost::tree::ascending::iterator<self_type>);
     
- std::stack<DescendingCursor> m_s; // pimpl?
+ std::stack<DescendingCursor> m_s; // pimpl?
      
     value_type& dereference() const
     {
@@ -241,17 +241,17 @@
     explicit root_tracking_cursor(ascending_cursor<Cursor> c)
     : root_tracking_cursor::cursor_adaptor_(c), m_root_depth(c.m_s.size()) {}
 
- template <class OtherCursor>
- root_tracking_cursor(
- root_tracking_cursor< ascending_cursor<OtherCursor> > const& other
- , typename boost::enable_if<
- boost::is_convertible<OtherCursor*
- , Cursor*>
- , enabler
- >::type = enabler()
- )
- : root_tracking_cursor::cursor_adaptor_(other.base())
- , m_root_depth(other.m_root_depth) {}
+// template <class OtherCursor>
+// root_tracking_cursor(
+// root_tracking_cursor< ascending_cursor<OtherCursor> > const& other
+// , typename boost::enable_if<
+// boost::is_convertible<OtherCursor*
+// , Cursor*>
+// , enabler
+// >::type = enabler()
+// )
+// : root_tracking_cursor::cursor_adaptor_(other.base())
+// , m_root_depth(other.m_root_depth) {}
 //
 // template <class OtherCursor>
 // root_tracking_cursor(

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/cursor.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/cursor.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/cursor.hpp 2008-09-29 11:35:42 EDT (Mon, 29 Sep 2008)
@@ -12,6 +12,9 @@
 #ifndef BOOST_TREE_CURSOR_HPP
 #define BOOST_TREE_CURSOR_HPP
 
+#include <boost/iterator/iterator_facade.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+
 #include <stddef.h>
 #include <iterator>
 
@@ -115,6 +118,19 @@
 };
 */
 
+//define freestanding begin, end, size, empty using cursor's member fns?
+
+template <
+ class OutputIterator
+// , class Value
+// , class HorizontalTraversalOrCategory
+// , class VerticalTraversalOrCategory
+// , class Reference
+// , class Difference
+// , class Size
+>
+class output_cursor_iterator_wrapper;
+
 /**
  * @brief Output cursor wrapper around an output iterator.
  *
@@ -127,14 +143,40 @@
  */
 // TODO: Complete this.
 // Shouldn't we be using cursor_facade?
-template<class OutputIterator>
+template <
+ class OutputIterator
+// , class Value = use_default
+// , class HorizontalTraversalOrCategory = use_default
+// , class VerticalTraversalOrCategory = bidirectional_traversal_tag
+// , class Reference = use_default
+// , class Difference = use_default
+// , class Size = use_default
+>
 class output_cursor_iterator_wrapper {
 protected:
     OutputIterator* iter;
+//private:
+// typedef iterator_adaptor<output_cursor_iterator_wrapper<OutputIterator>
+// , OutputIterator
+// , Value
+// , HorizontalTraversalOrCategory
+// , Reference
+// , Difference> ia_type;
 public:
     /// Make the iterator type publicly accessible.
     typedef OutputIterator iterator;
-
+
+ // FIXME: Very adhoc.
+ typedef output_cursor_iterator_wrapper<OutputIterator> value_type;
+ typedef std::size_t size_type;
+ typedef output_cursor_iterator_wrapper<OutputIterator> const_cursor;
+ typedef forward_traversal_tag horizontal_traversal;
+ typedef bidirectional_traversal_tag vertical_traversal;
+ typedef forward_traversal_tag iterator_category;
+ typedef std::ptrdiff_t difference_type;
+ typedef value_type* pointer;
+ typedef value_type& reference;
+
     /**
      * For construction, we obviously need an Output Iterator to work on (i.e., write to).
      */
@@ -169,8 +211,30 @@
     output_cursor_iterator_wrapper operator++(int) { return *this; }
 
     /// Returns *this, as this %cursor doesn't "move".
+ output_cursor_iterator_wrapper& operator--() { return *this; }
+
+ /// Returns *this, as this %cursor doesn't "move".
+ output_cursor_iterator_wrapper operator--(int) { return *this; }
+
+ /// Returns *this, as this %cursor doesn't "move".
     output_cursor_iterator_wrapper& to_begin() { return *this; }
     output_cursor_iterator_wrapper& begin() { return *this; }
+
+ /// Returns *this, as this %cursor doesn't "move".
+ output_cursor_iterator_wrapper& to_end() { return *this; }
+ output_cursor_iterator_wrapper& end() { return *this; }
+
+ /// Returns *this, as this %cursor doesn't "move".
+ output_cursor_iterator_wrapper& to_parent() { return *this; }
+ output_cursor_iterator_wrapper& parent() { return *this; }
+
+ /// Returns true, in case an algorithm has a loop only terminating at root.
+ bool is_root() const { return true; }
+
+ /// Returns true, in case an algorithm has a loop only terminating at a leaf.
+ bool empty() const { return true; }
+
+ std::size_t const parity() const { return 0; }
 };
 
 /**
@@ -186,8 +250,6 @@
     return output_cursor_iterator_wrapper<OutputIterator>(o);
 }
 
-//define freestanding begin, end, size, empty using cursor's member fns?
-
 } // namespace tree
 } // namespace boost
 

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/cursor_adaptor.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/cursor_adaptor.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/cursor_adaptor.hpp 2008-09-29 11:35:42 EDT (Mon, 29 Sep 2008)
@@ -32,36 +32,36 @@
 template <
     class Derived
   , class Base
- , class Value = use_default
+ , class Value = use_default
   , class HorizontalTraversalOrCategory = use_default
- , class VerticalTraversalOrCategory = use_default
- , class Reference = use_default
- , class Difference = use_default
- , class Size = use_default
+ , class VerticalTraversalOrCategory = use_default
+ , class Reference = use_default
+ , class Difference = use_default
+ , class Size = use_default
>
 class cursor_adaptor_base
 : private iterator_adaptor<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , Reference
- , Difference>
+ , Base
+ , Value
+ , HorizontalTraversalOrCategory
+ , Reference
+ , Difference>
 , private iterator_adaptor<Derived
- , Base
- , Value
- , VerticalTraversalOrCategory
- , Reference
- , Difference>
+ , Base
+ , Value
+ , VerticalTraversalOrCategory
+ , Reference
+ , Difference>
 {
 private:
     cursor_adaptor_base() {} // This class is used for typedefs only.
     
     typedef typename iterator_adaptor<Derived, Base, Value
- , HorizontalTraversalOrCategory, Reference
- , Difference>::super_t h_super_t;
+ , HorizontalTraversalOrCategory, Reference
+ , Difference>::super_t h_super_t;
     typedef typename iterator_adaptor<Derived, Base, Value
- , VerticalTraversalOrCategory, Reference
- , Difference>::super_t v_super_t;
+ , VerticalTraversalOrCategory, Reference
+ , Difference>::super_t v_super_t;
 public:
     typedef typename h_super_t::value_type value_type;
     typedef typename h_super_t::reference reference;
@@ -90,12 +90,12 @@
 template <
     class Derived
   , class Base
- , class Value = use_default
+ , class Value = use_default
   , class HorizontalTraversalOrCategory = use_default
- , class VerticalTraversalOrCategory = use_default
- , class Reference = use_default
- , class Difference = use_default
- , class Size = use_default
+ , class VerticalTraversalOrCategory = use_default
+ , class Reference = use_default
+ , class Difference = use_default
+ , class Size = use_default
>
 class cursor_adaptor
 : public cursor_adaptor_base< Derived
@@ -126,15 +126,15 @@
     { return m_cursor; }
     
 private:
- Base m_cursor;
+ mutable Base m_cursor; // mutable for use with output cursors.
     
     friend class iterator_core_access;
     friend class cursor_core_access;
 
-public:
- typedef Base base_type;
+public:
+ typedef Base base_type;
      
- typedef typename cursor_facade_::iterator_category iterator_category;
+ typedef typename cursor_facade_::iterator_category iterator_category;
 
     typedef typename cursor_facade_::horizontal_traversal horizontal_traversal;
     typedef typename cursor_facade_::vertical_traversal cursor_category;
@@ -149,38 +149,38 @@
     Base const& base() const
     { return m_cursor; }
     
- typename cursor_facade_::reference dereference() const
- {
- return *m_cursor;
- }
-
- void increment()
- {
- ++m_cursor;
- }
-
- void decrement()
- {
- --m_cursor;
- }
-
- template <class OtherDerived, class OtherCursor, class V, class C,
- class R, class D, class S>
- bool equal(cursor_adaptor<OtherDerived, OtherCursor,
- V, C, R, D, S> const& x) const
- {
- return m_cursor == x.base();
- }
-
- template <class OtherDerived, class OtherCursor, class V, class C,
- class R, class D, class S>
- Difference distance_to(cursor_adaptor<OtherDerived, OtherCursor,
- V, C, R, D, S> const& x) const
+ typename cursor_facade_::reference dereference() const
+ {
+ return *m_cursor;
+ }
+
+ void increment()
+ {
+ ++m_cursor;
+ }
+
+ void decrement()
+ {
+ --m_cursor;
+ }
+
+ template <class OtherDerived, class OtherCursor, class V, class C,
+ class R, class D, class S>
+ bool equal(cursor_adaptor<OtherDerived, OtherCursor,
+ V, C, R, D, S> const& x) const
+ {
+ return m_cursor == x.base();
+ }
+
+ template <class OtherDerived, class OtherCursor, class V, class C,
+ class R, class D, class S>
+ Difference distance_to(cursor_adaptor<OtherDerived, OtherCursor,
+ V, C, R, D, S> const& x) const
     {
         return x.base() - m_cursor;
     }
      
- bool const empty_() const
+ bool const empty_() const
     {
         return m_cursor.empty();
     }
@@ -216,7 +216,6 @@
     }
 };
 
-
 } // namespace tree
 } // namespace boost
 

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/cursor_facade.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/cursor_facade.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/cursor_facade.hpp 2008-09-29 11:35:42 EDT (Mon, 29 Sep 2008)
@@ -30,17 +30,17 @@
 using boost::iterator_core_access;
 
 class cursor_core_access {
- public:
-
- friend class iterator_core_access;
+public:
+
+ friend class iterator_core_access;
      
- template <class Facade>
+ template <class Facade>
     static bool empty_(Facade const& f)
     {
         return f.empty_();
     }
     
- template <class Facade>
+ template <class Facade>
     static typename Facade::size_type size_(Facade const& f)
     {
         return f.size_();
@@ -93,7 +93,7 @@
 class cursor_facade
  : public iterator_facade<Derived, Value, HorizontalCategoryOrTraversal,
                           Reference, Difference> {
- private:
+private:
     // Curiously Recurring Template interface.
 
     Derived& derived()
@@ -108,12 +108,12 @@
 
     typedef typename cursor_facade::iterator_facade_ iterator_facade_;
 
- protected:
- // For use by derived classes
+protected:
+ // For use by derived classes
     typedef cursor_facade<Derived, Value, HorizontalCategoryOrTraversal,
                           VerticalCategoryOrTraversal, Reference, Difference>
             cursor_facade_;
- public:
+public:
     typedef typename iterator_facade_::value_type value_type;
     typedef Reference reference;
     typedef Difference difference_type;
@@ -150,41 +150,41 @@
         return cursor_core_access::par(this->derived());
     }
 
- Derived& to_begin()
- {
+ Derived& to_begin()
+ {
         cursor_core_access::left(this->derived());
         return this->derived();
- }
+ }
                   
- Derived begin()
- {
- Derived tmp(this->derived());
- return tmp.to_begin();
- }
+ Derived begin()
+ {
+ Derived tmp(this->derived());
+ return tmp.to_begin();
+ }
 
- Derived& to_end()
- {
+ Derived& to_end()
+ {
         cursor_core_access::right(this->derived());
         return this->derived();
- }
+ }
      
- Derived end()
- {
- Derived tmp(this->derived());
- return tmp.to_end();
- }
+ Derived end()
+ {
+ Derived tmp(this->derived());
+ return tmp.to_end();
+ }
      
- Derived& to_parent()
- {
- cursor_core_access::up(this->derived());
- return this->derived();
- }
+ Derived& to_parent()
+ {
+ cursor_core_access::up(this->derived());
+ return this->derived();
+ }
      
- Derived parent()
- {
- Derived tmp(this->derived());
- return tmp.to_parent();
- }
+ Derived parent()
+ {
+ Derived tmp(this->derived());
+ return tmp.to_parent();
+ }
 };
 
 //TODO: Put somewhere else?

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/_order_iterative.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/_order_iterative.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor/_order_iterative.hpp 2008-09-29 11:35:42 EDT (Mon, 29 Sep 2008)
@@ -44,15 +44,29 @@
     return for_each(root_tracking_cursor<Cursor>(s), f);
 }
 
+// Iterative algorithms involving OutCursors are significantly more complicated,
+// as we need to navigate the OutCursor (say, t) in a fashion parallel to the Incursor
+// (s), eg:
+//
+// forward(s)
+// forward(t)
+//
+// But forward() is a quite complicated algorithm involving checks of parity() or
+// or moving to_parent() -- things that aren't implemented for output cursor
+// adaptors (yet?).
+
 template <class InCursor, class OutCursor>
-OutCursor copy (root_tracking_cursor<InCursor> s, OutCursor t)
+root_tracking_cursor<OutCursor> copy (root_tracking_cursor<InCursor> s
+ , root_tracking_cursor<OutCursor> t)
 {
     root_tracking_cursor<InCursor> s2(s);
     to_first(s);
     to_last(s2);
+ to_first(t);
     while (s!=s2) {
         *t = *s;
         forward(s);
+ forward(t);
     }
     return t;
 }
@@ -66,18 +80,24 @@
 template <class InCursor, class OutCursor>
 OutCursor copy (InCursor s, OutCursor t)
 {
- return copy(root_tracking_cursor<InCursor>(s), t);
+ root_tracking_cursor<OutCursor> u
+ = copy(root_tracking_cursor<InCursor>(s)
+ , root_tracking_cursor<OutCursor>(t));
+ return u.base();
 }
 
 template <class InCursor, class OutCursor, class Op>
-OutCursor transform (root_tracking_cursor<InCursor> s, OutCursor t, Op op)
+root_tracking_cursor<OutCursor> transform (root_tracking_cursor<InCursor> s
+ , root_tracking_cursor<OutCursor> t, Op op)
 {
     root_tracking_cursor<InCursor> s2(s);
     to_first(s);
     to_last(s2);
+ to_first(t);
     while (s!=s2) {
         *t = op(*s);
         forward(s);
+ forward(t);
     }
     return t;
 }
@@ -99,5 +119,8 @@
 template <class InCursor, class OutCursor, class Op>
 OutCursor transform (InCursor s, OutCursor t, Op op)
 {
- return transform(root_tracking_cursor<InCursor>(s), t, op);
+ root_tracking_cursor<OutCursor> u
+ = transform(root_tracking_cursor<InCursor>(s)
+ , root_tracking_cursor<OutCursor>(t), op);
+ return u.base();
 }
\ No newline at end of file

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-09-29 11:35:42 EDT (Mon, 29 Sep 2008)
@@ -91,9 +91,9 @@
 
 /*\@}*/
 
-//#ifndef BOOST_RECURSIVE_ORDER_ALGORITHMS
-//#include <boost/tree/detail/algorithm/cursor/_order_iterative.hpp>
-//#else
+#ifndef BOOST_RECURSIVE_ORDER_ALGORITHMS
+#include <boost/tree/detail/algorithm/cursor/_order_iterative.hpp>
+#else
 
 /**
  * @if maint
@@ -147,6 +147,8 @@
     return f;
 }
 
+//#endif //BOOST_RECURSIVE_ORDER_ALGORITHMS
+
 /**
  * @brief Copies the subtree s into t, by traversing s in inorder.
  * @param s An input cursor.
@@ -206,7 +208,7 @@
     return t;
 }
 
-//#endif //BOOST_RECURSIVE_ORDER_ALGORITHMS
+#endif //BOOST_RECURSIVE_ORDER_ALGORITHMS
 
 /// Search
 

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-09-29 11:35:42 EDT (Mon, 29 Sep 2008)
@@ -121,9 +121,9 @@
 
 /*\@}*/
 
-//#ifndef BOOST_RECURSIVE_ORDER_ALGORITHMS
-//#include <boost/tree/detail/algorithm/cursor/_order_iterative.hpp>
-//#else
+#ifndef BOOST_RECURSIVE_ORDER_ALGORITHMS
+#include <boost/tree/detail/algorithm/cursor/_order_iterative.hpp>
+#else
 
 /**
  * @if maint
@@ -175,6 +175,8 @@
     return f;
 }
 
+//#endif //BOOST_RECURSIVE_ORDER_ALGORITHMS
+
 /**
  * @brief Copies the subtree s into t, by traversing s in postorder.
  * @param s An input cursor.
@@ -235,7 +237,7 @@
     return t;
 }
 
-//#endif //BOOST_RECURSIVE_ORDER_ALGORITHMS
+#endif //BOOST_RECURSIVE_ORDER_ALGORITHMS
 
 } // namespace postorder
 

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-09-29 11:35:42 EDT (Mon, 29 Sep 2008)
@@ -116,9 +116,9 @@
 
 /*\@}*/
 
-//#ifndef BOOST_RECURSIVE_ORDER_ALGORITHMS
-//#include <boost/tree/detail/algorithm/cursor/_order_iterative.hpp>
-//#else
+#ifndef BOOST_RECURSIVE_ORDER_ALGORITHMS
+#include <boost/tree/detail/algorithm/cursor/_order_iterative.hpp>
+#else
 
 /**
  * @if maint
@@ -170,6 +170,8 @@
     return f;
 }
 
+//#endif //BOOST_RECURSIVE_ORDER_ALGORITHMS
+
 /**
  * @brief Copies the subtree s into t, by traversing s in preorder.
  * @param s An input cursor.
@@ -228,7 +230,7 @@
     return t;
 }
 
-//#endif //BOOST_RECURSIVE_ORDER_ALGORITHMS
+#endif //BOOST_RECURSIVE_ORDER_ALGORITHMS
 
 } // namespace preorder
 

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/cursor/nary.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/cursor/nary.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/cursor/nary.hpp 2008-09-29 11:35:42 EDT (Mon, 29 Sep 2008)
@@ -54,12 +54,12 @@
       
     struct enabler {};
      
- typedef Node node_type;
+ typedef Node node_type;
     typedef node_type* node_pointer;
     
 public:
 
- typedef typename mpl::eval_if<
+ typedef typename mpl::eval_if<
                         is_const<Node>
                        , add_const<typename Node::value_type>
                        , mpl::identity<typename Node::value_type>
@@ -69,8 +69,8 @@
     typedef typename node_type::size_type size_type;
 
     // Cursor-specific
- typedef nary_tree_cursor<node_type> cursor;
- typedef nary_tree_cursor<node_type const> const_cursor;
+ typedef nary_tree_cursor<node_type> cursor;
+ typedef nary_tree_cursor<node_type const> const_cursor;
     
     // Container-specific:
     typedef cursor iterator;
@@ -102,11 +102,11 @@
 
  private:
 
- friend class iterator_core_access;
+ friend class iterator_core_access;
     friend class cursor_core_access;
     
     friend class access_detach;
-
+
     value_type& dereference() const
     {
         return **static_cast<node_type*>(m_node);

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/root_tracking_cursor.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/root_tracking_cursor.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/root_tracking_cursor.hpp 2008-09-29 11:35:42 EDT (Mon, 29 Sep 2008)
@@ -32,18 +32,18 @@
                       , typename cursor_horizontal_traversal<Cursor>::type
                       , typename cursor_vertical_traversal<Cursor>::type
> {
- private:
+private:
     struct enabler {};
     typedef root_tracking_cursor<Cursor> self_type;
- public:
- typedef typename Cursor::value_type value_type;
+public:
+ typedef typename Cursor::value_type value_type;
 
     // Container-specific:
     typedef typename Cursor::size_type size_type;
 
     // Cursor-specific
- typedef root_tracking_cursor<Cursor> cursor;
- typedef root_tracking_cursor<typename Cursor::const_cursor> const_cursor;
+ typedef root_tracking_cursor<Cursor> cursor;
+ typedef root_tracking_cursor<typename Cursor::const_cursor> const_cursor;
     
     // Container-specific:
     typedef cursor iterator;
@@ -71,7 +71,7 @@
 // : root_tracking_cursor::cursor_adaptor_(other.base())
 // , m_depth(other.m_depth) {}
 
- private:
+private:
     friend class boost::iterator_core_access;
     friend class boost::tree::cursor_core_access;
      
@@ -112,6 +112,101 @@
     return root_tracking_cursor<Cursor>(c);
 }
 
+//template <class OutputIterator>
+//class root_tracking_cursor< output_cursor_iterator_wrapper<OutputIterator> >
+//: public cursor_adaptor<root_tracking_cursor< output_cursor_iterator_wrapper<OutputIterator> >
+// , output_cursor_iterator_wrapper<OutputIterator>
+// , boost::use_default
+// , forward_traversal_tag
+// , bidirectional_traversal_tag
+// > {
+// private:
+// struct enabler {};
+// typedef root_tracking_cursor< output_cursor_iterator_wrapper<OutputIterator> > self_type;
+// public:
+// //typedef typename ascending_cursor<Cursor>::value_type value_type;
+//
+// // Container-specific:
+// //typedef typename ascending_cursor<Cursor>::size_type size_type;
+//
+// // Cursor-specific
+// //typedef root_tracking_cursor< ascending_cursor<Cursor> > cursor;
+// //typedef root_tracking_cursor<
+// // typename ascending_cursor<Cursor>::const_cursor > const_cursor;
+//
+// // Container-specific:
+// //typedef cursor iterator;
+// //typedef const_cursor const_iterator;
+//
+//// template <class OtherCursor>
+//// struct rebind {
+//// typedef root_tracking_cursor< ascending_cursor<OtherCursor> > other;
+//// };
+//
+// root_tracking_cursor()
+// : root_tracking_cursor::cursor_adaptor_(), m_depth(0) {}
+//
+// explicit root_tracking_cursor(output_cursor_iterator_wrapper<OutputIterator> c)
+// : root_tracking_cursor::cursor_adaptor_(c), m_depth(0) {}
+//
+//// template <class OtherCursor>
+//// root_tracking_cursor(
+//// root_tracking_cursor< ascending_cursor<OtherCursor> > const& other
+//// , typename boost::enable_if<
+//// boost::is_convertible<OtherCursor*
+//// , Cursor*>
+//// , enabler
+//// >::type = enabler()
+//// )
+//// : root_tracking_cursor::cursor_adaptor_(other.base())
+//// , m_root_depth(other.m_root_depth) {}
+////
+//// template <class OtherCursor>
+//// root_tracking_cursor(
+//// root_tracking_cursor<OtherCursor> const& other
+//// , typename boost::enable_if<
+//// boost::is_convertible<OtherCursor*
+//// , ascending_cursor<Cursor>*>
+//// , enabler
+//// >::type = enabler()
+//// )
+//// : root_tracking_cursor::cursor_adaptor_(other.base())
+//// , m_root_depth(other.base().m_s.size()) {}
+//
+// private:
+// std::size_t m_depth;
+//
+// friend class boost::iterator_core_access;
+// friend class boost::tree::cursor_core_access;
+//
+//// bool equal(cursor const& other) const
+//// {
+//// }
+//
+// void left()
+// {
+// ++m_depth;
+// this->base_reference().to_begin();
+// }
+//
+// void right()
+// {
+// ++m_depth;
+// this->base_reference().to_end();
+// }
+//
+// void up()
+// {
+// --m_depth;
+// this->base_reference().to_parent();
+// }
+//
+//public:
+// bool is_root() const
+// {
+// return !m_depth;
+// }
+//};
 
 } // namespace tree
 } // namespace boost


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