Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49052 - in sandbox/SOC/2006/tree/trunk/boost/tree: . detail/algorithm
From: ockham_at_[hidden]
Date: 2008-09-29 18:01:46


Author: bernhard.reiter
Date: 2008-09-29 18:01:45 EDT (Mon, 29 Sep 2008)
New Revision: 49052
URL: http://svn.boost.org/trac/boost/changeset/49052

Log:
More cleanup.
Removed:
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor.hpp
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/iterator.hpp
Text files modified:
   sandbox/SOC/2006/tree/trunk/boost/tree/algorithm.hpp | 78 +++++++++++++++++++++++++++++++++++----
   sandbox/SOC/2006/tree/trunk/boost/tree/binary_tree.hpp | 4 +-
   sandbox/SOC/2006/tree/trunk/boost/tree/iterator.hpp | 48 +++++++++++++++++++++++-
   3 files changed, 117 insertions(+), 13 deletions(-)

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 2008-09-29 18:01:45 EDT (Mon, 29 Sep 2008)
@@ -4,8 +4,8 @@
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-/**
- * @file algorithm.hpp
+/** @file algorithm.hpp
+ *
  * Hierarchy algorithms
  */
 
@@ -13,13 +13,74 @@
 #define BOOST_TREE_ALGORITHM_HPP
 
 #include <boost/tree/detail/algorithm/cursor/general.hpp>
-
 #include <boost/tree/detail/algorithm/cursor/ascending.hpp>
 
-#include <boost/tree/detail/algorithm/cursor.hpp>
-#include <boost/tree/detail/algorithm/iterator.hpp>
+#include <boost/tree/detail/algorithm/cursor/preorder.hpp>
+#include <boost/tree/detail/algorithm/cursor/inorder.hpp>
+#include <boost/tree/detail/algorithm/cursor/postorder.hpp>
+
+#ifndef BOOST_RECURSIVE_ORDER_ALGORITHMS
+#include <boost/tree/detail/algorithm/cursor/iterative.hpp>
+#endif
+
+namespace boost {
+namespace tree {
+
+/**
+ * @brief Successor
+ * @param c A cursor
+ * @param n Optional parameter to indicate how many steps to move forward
+ * @return Successor of @a c
+ */
+template <class Order, class Cursor>
+inline Cursor next(Cursor c
+ , typename Cursor::difference_type n = 1)
+{
+ for (; n!=0; --n)
+ forward<Order>(c);
+ return c;
+}
+
+/**
+ * @brief Predecessor
+ * @param c A cursor
+ * @param n Optional parameter to indicate how many steps to move back
+ * @return Predecessor of @a c
+ */
+template <class Order, class Cursor>
+inline Cursor prior(Cursor c
+ , typename Cursor::difference_type n = 1)
+{
+ for (; n!=0; --n)
+ back<Order>(c);
+ return c;
+}
+
+/**
+ * @brief First element of a subtree in preorder traversal
+ * @param c A cursor
+ * @return Cursor to the first element of @a c in preorder traversal
+ */
+template <class Order, class Cursor>
+Cursor first(Cursor c)
+{
+ to_first<Order>(c);
+ return c;
+}
 
-#include <algorithm>
+/**
+ * @brief One position past the last element of a subtree in preorder
+ * traversal
+ * @param c A cursor
+ * @return Cursor one position past the last element of @a c in preorder
+ * traversal
+ */
+template <class Order, class Cursor>
+Cursor last(Cursor c)
+{
+ to_last<Order>(c);
+ return c;
+}
 
 template <class AscendingCursor>
 typename AscendingCursor::size_type parity(AscendingCursor& cur)
@@ -27,6 +88,7 @@
     return std::distance(cur.parent().begin(), cur);
 }
 
-#endif // BOOST_TREE_ALGORITHM_HPP
-
+} // namespace tree
+} // namespace boost
 
+#endif //BOOST_TREE_ALGORITHM_HPP
\ No newline at end of file

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/binary_tree.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/binary_tree.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/binary_tree.hpp 2008-09-29 18:01:45 EDT (Mon, 29 Sep 2008)
@@ -13,8 +13,8 @@
 #define BOOST_TREE_BINARY_TREE_HPP
 
 #include <boost/tree/cursor.hpp>
-#include <boost/tree/detail/algorithm/cursor/general.hpp>
-#include <boost/tree/detail/algorithm/iterator.hpp>
+#include <boost/tree/iterator.hpp>
+#include <boost/tree/algorithm.hpp>
 
 #include <boost/tree/detail/node/traits.hpp>
 #include <boost/tree/detail/cursor/nary.hpp>

Deleted: sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/cursor.hpp 2008-09-29 18:01:45 EDT (Mon, 29 Sep 2008)
+++ (empty file)
@@ -1,87 +0,0 @@
-// Copyright (c) 2006-2008, Bernhard Reiter
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-/** @file cursor.hpp
- *
- * Some algorithm versions that are identical for all *order cursors
- * (as we are just calling the appropriate traversal function that are
- * defined in the respective *order.hpp files).
- */
-
-#ifndef BOOST_TREE_DETAIL_ALGORITHM_CURSOR_HPP
-#define BOOST_TREE_DETAIL_ALGORITHM_CURSOR_HPP
-
-#include <boost/tree/detail/algorithm/cursor/preorder.hpp>
-#include <boost/tree/detail/algorithm/cursor/inorder.hpp>
-#include <boost/tree/detail/algorithm/cursor/postorder.hpp>
-
-#ifndef BOOST_RECURSIVE_ORDER_ALGORITHMS
-#include <boost/tree/detail/algorithm/cursor/iterative.hpp>
-#endif
-
-namespace boost {
-namespace tree {
-
-/**
- * @brief Successor
- * @param c A cursor
- * @param n Optional parameter to indicate how many steps to move forward
- * @return Successor of @a c
- */
-template <class Order, class Cursor>
-inline Cursor next(Cursor c
- , typename Cursor::difference_type n = 1)
-{
- for (; n!=0; --n)
- forward<Order>(c);
- return c;
-}
-
-/**
- * @brief Predecessor
- * @param c A cursor
- * @param n Optional parameter to indicate how many steps to move back
- * @return Predecessor of @a c
- */
-template <class Order, class Cursor>
-inline Cursor prior(Cursor c
- , typename Cursor::difference_type n = 1)
-{
- for (; n!=0; --n)
- back<Order>(c);
- return c;
-}
-
-/**
- * @brief First element of a subtree in preorder traversal
- * @param c A cursor
- * @return Cursor to the first element of @a c in preorder traversal
- */
-template <class Order, class Cursor>
-Cursor first(Cursor c)
-{
- to_first<Order>(c);
- return c;
-}
-
-/**
- * @brief One position past the last element of a subtree in preorder
- * traversal
- * @param c A cursor
- * @return Cursor one position past the last element of @a c in preorder
- * traversal
- */
-template <class Order, class Cursor>
-Cursor last(Cursor c)
-{
- to_last<Order>(c);
- return c;
-}
-
-} // namespace tree
-} // namespace boost
-
-#endif //BOOST_TREE_DETAIL_ALGORITHM_CURSOR_HPP
\ No newline at end of file

Deleted: sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/iterator.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/iterator.hpp 2008-09-29 18:01:45 EDT (Mon, 29 Sep 2008)
+++ (empty file)
@@ -1,70 +0,0 @@
-// Copyright (c) 2006-2008, Bernhard Reiter
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-/** @file iterator.hpp
- *
- * Some definitions that are identical for all *order cursors (as we are just
- * calling the appropriate traversal function that are defined in the
- * respective *order.hpp files).
- */
-
-#ifndef BOOST_TREE_DETAIL_ALGORITHM_ITERATOR_HPP
-#define BOOST_TREE_DETAIL_ALGORITHM_ITERATOR_HPP
-
-#include <boost/tree/iterator.hpp>
-#include <boost/tree/detail/algorithm/cursor.hpp>
-
-namespace boost {
-namespace tree {
-
-/**
- * @brief First element of a subtree in traversal
- * (equivalent to postorder::begin())
- * @param c A cursor
- * @return Iterator to the first element of @a c
- */
-template <class Order, class Cursor>
-iterator<Order, Cursor>
-begin(Order, Cursor c)
-{
- to_first(Order(), c);
- return iterator<Order, Cursor>(c);
-}
-
-/**
- * @brief One position past the last element of a subtree
- * in traversal (Alias of cend())
- * @param c A cursor
- * @return Iterator one position past the last element of @a c
- */
-template <class Order, class Cursor>
-iterator<Order, Cursor>
-end(Order, Cursor c)
-{
- to_last(Order(), c);
- return iterator<Order, Cursor>(c);
-}
-
-/// Reverse iterators
-
-template <class Order, class Cursor>
-std::reverse_iterator< iterator<Order, Cursor> >
-rbegin(Order, Cursor c)
-{
- return std::reverse_iterator< iterator<Order, Cursor> >(end(Order(), c));
-}
-
-template <class Order, class Cursor>
-std::reverse_iterator< iterator<Order, Cursor> >
-rend(Order, Cursor c)
-{
- return std::reverse_iterator< iterator<Order, Cursor> >(begin(Order(), c));
-}
-
-} // namespace tree
-} // namespace boost
-
-#endif //BOOST_TREE_DETAIL_ALGORITHM_ITERATOR_HPP
\ No newline at end of file

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/iterator.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/iterator.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/iterator.hpp 2008-09-29 18:01:45 EDT (Mon, 29 Sep 2008)
@@ -6,9 +6,7 @@
 
 /** @file iterator.hpp
  *
- * Some definitions that are identical for all *order cursors (as we are just
- * calling the appropriate traversal function that are defined in the
- * respective *order.hpp files).
+ * Iterator wrapper around a cursor, using a given type of traversal.
  */
 
 #ifndef BOOST_TREE_ITERATOR_HPP
@@ -75,6 +73,50 @@
     }
 };
 
+/**
+ * @brief First element of a subtree in traversal
+ * (equivalent to postorder::begin())
+ * @param c A cursor
+ * @return Iterator to the first element of @a c
+ */
+template <class Order, class Cursor>
+iterator<Order, Cursor>
+begin(Order, Cursor c)
+{
+ to_first(Order(), c);
+ return iterator<Order, Cursor>(c);
+}
+
+/**
+ * @brief One position past the last element of a subtree
+ * in traversal (Alias of cend())
+ * @param c A cursor
+ * @return Iterator one position past the last element of @a c
+ */
+template <class Order, class Cursor>
+iterator<Order, Cursor>
+end(Order, Cursor c)
+{
+ to_last(Order(), c);
+ return iterator<Order, Cursor>(c);
+}
+
+/// Reverse iterators
+
+template <class Order, class Cursor>
+std::reverse_iterator< iterator<Order, Cursor> >
+rbegin(Order, Cursor c)
+{
+ return std::reverse_iterator< iterator<Order, Cursor> >(end(Order(), c));
+}
+
+template <class Order, class Cursor>
+std::reverse_iterator< iterator<Order, Cursor> >
+rend(Order, Cursor c)
+{
+ return std::reverse_iterator< iterator<Order, Cursor> >(begin(Order(), c));
+}
+
 } // 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