Boost logo

Boost-Commit :

From: ockham_at_[hidden]
Date: 2008-05-06 10:30:14


Author: bernhard.reiter
Date: 2008-05-06 10:30:14 EDT (Tue, 06 May 2008)
New Revision: 45172
URL: http://svn.boost.org/trac/boost/changeset/45172

Log:
More cursor (helper) related fixes.
Text files modified:
   sandbox/SOC/2006/tree/trunk/TODO | 5 +++--
   sandbox/SOC/2006/tree/trunk/boost/tree/cursor_helpers.hpp | 7 -------
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/cursor/nary.hpp | 27 ++++++---------------------
   3 files changed, 9 insertions(+), 30 deletions(-)

Modified: sandbox/SOC/2006/tree/trunk/TODO
==============================================================================
--- sandbox/SOC/2006/tree/trunk/TODO (original)
+++ sandbox/SOC/2006/tree/trunk/TODO 2008-05-06 10:30:14 EDT (Tue, 06 May 2008)
@@ -15,8 +15,7 @@
 
 General:
 
-* Unify const_cusor and cursor facades/adapters. Otherwise their use is ridiculously complicated and redundant.
- (Something along the lines of implementing one of them and then providing a shortcut to build the other one around it).
+* Should const_cursor have cbegin(), cend() and cparent() members?
 * Implement "flat" (sequential *order representation) trees (cf. Knuth, Fundamental Algorithms,
   pp. 348--351). Those should be especially useful for automated testing of "real" (binary,
   forest) trees.
@@ -59,6 +58,8 @@
 
 Proposal:
 
+* cursor's begin(), end() and parent() members now only return cursor, same for const_cursor.
+ (This somewhat breaks with container requirements, but it makes sense this way.)
 * Add InputCursor requirements: binary cursor if it's a binary_tree member function, etc.
 * Cursor validity after insertion/erasure/clearing
 * Possibly rename ascending to hierarchy cursor? (because of other uses for ascending/cursors in a graph context)

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/cursor_helpers.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/cursor_helpers.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/cursor_helpers.hpp 2008-05-06 10:30:14 EDT (Tue, 06 May 2008)
@@ -128,10 +128,6 @@
 
         typedef bidirectional_traversal_tag cursor_category;
 
-// typedef typename Derived::template rebind<value_type>::other cursor;
-// typedef typename Derived::template rebind<add_const<value_type> >::other
-// const_cursor;
-
         bool const empty() const
         {
                 return cursor_core_access::empty_(this->derived());
@@ -152,8 +148,6 @@
                 return cursor_core_access::par(this->derived());
         }
                          
- // if Value is const: Derived == const_cursor: only Derived
- // otherwise: also Derived const. Really? implicit conversion to const_cursor?
          Derived begin()
          {
                 return cursor_core_access::left(this->derived());
@@ -168,7 +162,6 @@
          {
                 return cursor_core_access::up(this->derived());
          }
- //if Value isn't const: also cursor.
 };
 
 template <

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-05-06 10:30:14 EDT (Tue, 06 May 2008)
@@ -158,37 +158,22 @@
         
 public:
 
- cursor begin()
+ cursor left() const
         {
                 return cursor(m_node->operator[](m_pos), 0);
         }
-/*
- const_cursor left() const
- {
- return const_cursor(m_node->operator[](m_pos), 0);
- }
-*/
- cursor end()
+
+ cursor right() const
         {
                 return cursor(m_node->operator[](m_pos), m_node->size()-1);
         }
-/*
- const_cursor right() const
- {
- return const_cursor(m_node->operator[](m_pos), m_node->size()-1);
- }
-*/
+
         // Cursor stuff
- cursor parent()
+ cursor up() const
         {
                 return cursor(static_cast<base_pointer>(m_node->parent()), m_node->get_parity());
         }
-/*
- const_cursor up() const
- {
- return const_cursor(static_cast<base_pointer>(m_node->parent()), m_node->get_parity());
- }
-*/
+
 public:
         // TODO: protect?
         void attach(node_pointer p_node)


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