|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r49023 - sandbox/SOC/2006/tree/trunk/boost/tree/detail/iterator
From: ockham_at_[hidden]
Date: 2008-09-29 14:38:29
Author: bernhard.reiter
Date: 2008-09-29 14:38:29 EDT (Mon, 29 Sep 2008)
New Revision: 49023
URL: http://svn.boost.org/trac/boost/changeset/49023
Log:
Re-arrange *order algorithms from namespaces to a policy(=template)-based mechanism, part 6.
Added:
sandbox/SOC/2006/tree/trunk/boost/tree/detail/iterator/iterator.hpp (contents, props changed)
Removed:
sandbox/SOC/2006/tree/trunk/boost/tree/detail/iterator/_order.hpp
Deleted: sandbox/SOC/2006/tree/trunk/boost/tree/detail/iterator/_order.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/iterator/_order.hpp 2008-09-29 14:38:29 EDT (Mon, 29 Sep 2008)
+++ (empty file)
@@ -1,81 +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_ITERATOR_ITERATOR_HPP
-#define BOOST_TREE_DETAIL_ITERATOR_ITERATOR_HPP
-
-//#include <boost/tree/cursor.hpp>
-
-#include <boost/iterator/iterator_adaptor.hpp>
-#include <boost/type_traits/is_convertible.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost {
-namespace tree {
-
-/**
- * @brief Traversal order iterator adaptor
- *
- * Only works with ascending cursors.
- */
-template <class Order, class Cursor>
-class iterator
- : public boost::iterator_adaptor<iterator<Order, Cursor>
- , Cursor
- , boost::use_default
- , bidirectional_traversal_tag
- > {
- private:
- struct enabler {};
-
- public:
- iterator()
- : iterator::iterator_adaptor_() {}
-
- explicit iterator(Cursor p)
- : iterator::iterator_adaptor_(p) {}
-
- template <class OtherCursor>
- iterator(
- iterator<Order, OtherCursor> const& other
- , typename boost::enable_if<
- boost::is_convertible<OtherCursor, Cursor>
- , enabler
- >::type = enabler()
- )
- : iterator::iterator_adaptor_(other.base()) {}
-
- operator Cursor()
- {
- return this->base();
- }
- private:
- friend class boost::iterator_core_access;
-
- void increment()
- {
- forward(this->base_reference());
- //BOOST_ASSERT(!this->base_reference().parity() || this->base_reference().is_root());
- }
-
- void decrement()
- {
- back(this->base_reference());
- //BOOST_ASSERT(!this->base_reference().parity() || this->base_reference().is_root());
- }
-};
-
-} // namespace tree
-} // namespace boost
-
-#endif //BOOST_TREE_DETAIL_ITERATOR_ITERATOR_HPP
\ No newline at end of file
Added: sandbox/SOC/2006/tree/trunk/boost/tree/detail/iterator/iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/iterator/iterator.hpp 2008-09-29 14:38:29 EDT (Mon, 29 Sep 2008)
@@ -0,0 +1,81 @@
+// 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_ITERATOR_ITERATOR_HPP
+#define BOOST_TREE_DETAIL_ITERATOR_ITERATOR_HPP
+
+//#include <boost/tree/cursor.hpp>
+
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/utility/enable_if.hpp>
+
+namespace boost {
+namespace tree {
+
+/**
+ * @brief Traversal order iterator adaptor
+ *
+ * Only works with ascending cursors.
+ */
+template <class Order, class Cursor>
+class iterator
+ : public boost::iterator_adaptor<iterator<Order, Cursor>
+ , Cursor
+ , boost::use_default
+ , bidirectional_traversal_tag
+ > {
+ private:
+ struct enabler {};
+
+ public:
+ iterator()
+ : iterator::iterator_adaptor_() {}
+
+ explicit iterator(Cursor p)
+ : iterator::iterator_adaptor_(p) {}
+
+ template <class OtherCursor>
+ iterator(
+ iterator<Order, OtherCursor> const& other
+ , typename boost::enable_if<
+ boost::is_convertible<OtherCursor, Cursor>
+ , enabler
+ >::type = enabler()
+ )
+ : iterator::iterator_adaptor_(other.base()) {}
+
+ operator Cursor()
+ {
+ return this->base();
+ }
+ private:
+ friend class boost::iterator_core_access;
+
+ void increment()
+ {
+ forward(this->base_reference());
+ //BOOST_ASSERT(!this->base_reference().parity() || this->base_reference().is_root());
+ }
+
+ void decrement()
+ {
+ back(this->base_reference());
+ //BOOST_ASSERT(!this->base_reference().parity() || this->base_reference().is_root());
+ }
+};
+
+} // namespace tree
+} // namespace boost
+
+#endif //BOOST_TREE_DETAIL_ITERATOR_ITERATOR_HPP
\ 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