|
Boost-Commit : |
From: ockham_at_[hidden]
Date: 2008-06-27 13:36:04
Author: bernhard.reiter
Date: 2008-06-27 13:36:03 EDT (Fri, 27 Jun 2008)
New Revision: 46782
URL: http://svn.boost.org/trac/boost/changeset/46782
Log:
Split cursor_helpers.hpp into cursor_facade.hpp and cursor_adaptor.hpp
Added:
sandbox/SOC/2006/tree/trunk/boost/tree/cursor_adaptor.hpp (contents, props changed)
sandbox/SOC/2006/tree/trunk/boost/tree/cursor_facade.hpp
- copied, changed from r46781, /sandbox/SOC/2006/tree/trunk/boost/tree/cursor_helpers.hpp
Removed:
sandbox/SOC/2006/tree/trunk/boost/tree/cursor_helpers.hpp
Text files modified:
sandbox/SOC/2006/tree/trunk/boost/tree/ascending_cursor.hpp | 2
sandbox/SOC/2006/tree/trunk/boost/tree/cursor_facade.hpp | 245 ---------------------------------------
sandbox/SOC/2006/tree/trunk/boost/tree/detail/cursor/forest.hpp | 83 -------------
sandbox/SOC/2006/tree/trunk/boost/tree/detail/cursor/multiway.hpp | 11 -
sandbox/SOC/2006/tree/trunk/boost/tree/detail/cursor/nary.hpp | 2
5 files changed, 13 insertions(+), 330 deletions(-)
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-06-27 13:36:03 EDT (Fri, 27 Jun 2008)
@@ -14,7 +14,7 @@
#include <boost/tree/cursor.hpp>
-#include <boost/tree/cursor_helpers.hpp>
+#include <boost/tree/cursor_facade.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
Added: sandbox/SOC/2006/tree/trunk/boost/tree/cursor_adaptor.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/cursor_adaptor.hpp 2008-06-27 13:36:03 EDT (Fri, 27 Jun 2008)
@@ -0,0 +1,265 @@
+// 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_adaptor.hpp
+ * Cursor adaptor implementation
+ */
+
+// TODO: Use TR1 type_traits (integral_constant)
+
+#ifndef BOOST_TREE_CURSOR_ADAPTOR_HPP
+#define BOOST_TREE_CURSOR_ADAPTOR_HPP
+
+#include <boost/tree/cursor.hpp>
+
+#include <boost/tree/cursor_facade.hpp>
+
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+namespace boost {
+namespace tree {
+
+using boost::iterator_core_access;
+
+// We'll abuse iterator_adaptor to determine our types.
+template <
+ class Derived
+ , class Base
+ , 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 eval_use_default
+: private iterator_adaptor<Derived
+ , Base
+ , Value
+ , HorizontalTraversalOrCategory
+ , Reference
+ , Difference>
+, private iterator_adaptor<Derived
+ , Base
+ , Value
+ , VerticalTraversalOrCategory
+ , Reference
+ , Difference>
+{
+private:
+ eval_use_default() {} // This class is used for typedefs only.
+
+ typedef typename iterator_adaptor<Derived, Base, Value
+ , HorizontalTraversalOrCategory, Reference
+ , Difference>::super_t h_super_t;
+ typedef typename iterator_adaptor<Derived, Base, Value
+ , 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;
+ typedef typename h_super_t::difference_type difference_type;
+ typedef typename h_super_t::pointer pointer;
+ typedef typename h_super_t::iterator_category iterator_category;
+ typedef typename v_super_t::iterator_category vertical_traversal;
+
+ // size_type isn't in iterator_adaptor or _facade,
+ // so we have to calculate it on our own:
+ typedef typename mpl::eval_if<
+ is_same<Size, use_default>
+ , boost::tree::cursor_size<Base>
+ , mpl::identity<Size>
+ >::type size_type;
+};
+
+template <
+ class Derived
+ , class Base
+ , 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 cursor_adaptor
+: public cursor_facade<
+ Derived
+ , typename eval_use_default<Derived
+ , Base
+ , Value
+ , HorizontalTraversalOrCategory
+ , VerticalTraversalOrCategory
+ , Reference
+ , Difference
+ , Size>::value_type
+ , typename eval_use_default<Derived
+ , Base
+ , Value
+ , HorizontalTraversalOrCategory
+ , VerticalTraversalOrCategory
+ , Reference
+ , Difference
+ , Size>::iterator_category
+ , typename eval_use_default<Derived
+ , Base
+ , Value
+ , HorizontalTraversalOrCategory
+ , VerticalTraversalOrCategory
+ , Reference
+ , Difference
+ , Size>::vertical_traversal
+ , typename eval_use_default<Derived
+ , Base
+ , Value
+ , HorizontalTraversalOrCategory
+ , VerticalTraversalOrCategory
+ , Reference
+ , Difference
+ , Size>::reference
+ , typename eval_use_default<Derived
+ , Base
+ , Value
+ , HorizontalTraversalOrCategory
+ , VerticalTraversalOrCategory
+ , Reference
+ , Difference
+ , Size>::difference_type
+ , typename eval_use_default<Derived
+ , Base
+ , Value
+ , HorizontalTraversalOrCategory
+ , VerticalTraversalOrCategory
+ , Reference
+ , Difference
+ , Size>::size_type>
+{
+ friend class iterator_core_access;
+ friend class cursor_core_access;
+ typedef cursor_facade<Derived
+ , Value
+ , HorizontalTraversalOrCategory
+ , VerticalTraversalOrCategory
+ , Reference
+ , Difference
+ , Size> cursor_facade_;
+
+ public:
+ cursor_adaptor() {}
+
+ explicit cursor_adaptor(Base const& cur) : m_cursor(cur)
+ { }
+
+ Base const& base() const
+ { return m_cursor; }
+
+ typedef typename cursor_facade_::iterator_category iterator_category;
+
+ typedef typename cursor_facade_::horizontal_traversal horizontal_traversal;
+ typedef typename cursor_facade_::vertical_traversal cursor_category;
+
+ typedef Size size_type;
+ typedef Base base_type;
+
+ protected:
+ typedef cursor_adaptor<Derived, Base, Value, HorizontalTraversalOrCategory,
+ VerticalTraversalOrCategory, Reference, Difference,
+ Size> cursor_adaptor_;
+
+ typedef eval_use_default<Derived
+ , Base
+ , Value
+ , HorizontalTraversalOrCategory
+ , VerticalTraversalOrCategory
+ , Reference
+ , Difference
+ , Size> super_t;
+
+ Base const& base_reference() const
+ { return m_cursor; }
+
+ Base& base_reference()
+ { return m_cursor; }
+
+ public:
+
+ typename super_t::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
+ {
+ return m_cursor.empty();
+ }
+
+ size_type const size_() const
+ {
+ return m_cursor.size();
+ }
+
+ size_type const max_size_() const
+ {
+ return m_cursor.max_size();
+ }
+
+ size_type const par() const
+ {
+ return m_cursor.parity();
+ }
+
+ void left()
+ {
+ m_cursor.to_begin();
+ }
+
+ void right()
+ {
+ m_cursor.to_end();
+ }
+
+ void up()
+ {
+ m_cursor.to_parent();
+ }
+
+private:
+ Base m_cursor;
+};
+
+
+} // namespace tree
+} // namespace boost
+
+#endif // BOOST_TREE_CURSOR_ADAPTOR_HPP
Copied: sandbox/SOC/2006/tree/trunk/boost/tree/cursor_facade.hpp (from r46781, /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_facade.hpp 2008-06-27 13:36:03 EDT (Fri, 27 Jun 2008)
@@ -5,14 +5,14 @@
// http://www.boost.org/LICENSE_1_0.txt)
/**
- * @file cursor_helpers.hpp
- * Cursor facade and adaptor implementations
+ * @file cursor_facade.hpp
+ * Cursor facade implementation
*/
// TODO: Use TR1 type_traits (integral_constant)
-#ifndef BOOST_TREE_CURSOR_HELPERS_HPP
-#define BOOST_TREE_CURSOR_HELPERS_HPP
+#ifndef BOOST_TREE_CURSOR_FACADE_HPP
+#define BOOST_TREE_CURSOR_FACADE_HPP
#include <boost/tree/cursor.hpp>
@@ -24,9 +24,6 @@
#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp>
-#include <iterator>
-#include <utility>
-
namespace boost {
namespace tree {
@@ -190,238 +187,6 @@
}
};
-// We'll abuse iterator_adaptor to determine our types.
-template <
- class Derived
- , class Base
- , 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 eval_use_default
-: private iterator_adaptor<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , Reference
- , Difference>
-, private iterator_adaptor<Derived
- , Base
- , Value
- , VerticalTraversalOrCategory
- , Reference
- , Difference>
-{
-private:
- eval_use_default() {} // This class is used for typedefs only.
-
- typedef typename iterator_adaptor<Derived, Base, Value
- , HorizontalTraversalOrCategory, Reference
- , Difference>::super_t h_super_t;
- typedef typename iterator_adaptor<Derived, Base, Value
- , 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;
- typedef typename h_super_t::difference_type difference_type;
- typedef typename h_super_t::pointer pointer;
- typedef typename h_super_t::iterator_category iterator_category;
- typedef typename v_super_t::iterator_category vertical_traversal;
-
- // size_type isn't in iterator_adaptor,
- // so we have to calculate it on our own:
- typedef typename mpl::eval_if<
- is_same<Size, use_default>
- , boost::tree::cursor_size<Base>
- , mpl::identity<Size>
- >::type size_type;
-};
-
-template <
- class Derived
- , class Base
- , 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 cursor_adaptor
-: public cursor_facade<
- Derived
- , typename eval_use_default<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size>::value_type
- , typename eval_use_default<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size>::iterator_category
- , typename eval_use_default<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size>::vertical_traversal
- , typename eval_use_default<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size>::reference
- , typename eval_use_default<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size>::difference_type
- , typename eval_use_default<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size>::size_type>
-{
- friend class iterator_core_access;
- friend class cursor_core_access;
- typedef cursor_facade<Derived
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size> cursor_facade_;
-
- public:
- cursor_adaptor() {}
-
- explicit cursor_adaptor(Base const& cur) : m_cursor(cur)
- { }
-
- Base const& base() const
- { return m_cursor; }
-
- typedef typename cursor_facade_::iterator_category iterator_category;
-
- typedef typename cursor_facade_::horizontal_traversal horizontal_traversal;
- typedef typename cursor_facade_::vertical_traversal cursor_category;
-
- typedef Size size_type;
- typedef Base base_type;
-
- protected:
- typedef cursor_adaptor<Derived, Base, Value, HorizontalTraversalOrCategory,
- VerticalTraversalOrCategory, Reference, Difference,
- Size> cursor_adaptor_;
-
- typedef eval_use_default<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size> super_t;
-
- Base const& base_reference() const
- { return m_cursor; }
-
- Base& base_reference()
- { return m_cursor; }
-
- public:
-
- typename super_t::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
- {
- return m_cursor.empty();
- }
-
- size_type const size_() const
- {
- return m_cursor.size();
- }
-
- size_type const max_size_() const
- {
- return m_cursor.max_size();
- }
-
- size_type const par() const
- {
- return m_cursor.parity();
- }
-
- void left()
- {
- m_cursor.to_begin();
- }
-
- void right()
- {
- m_cursor.to_end();
- }
-
- void up()
- {
- m_cursor.to_parent();
- }
-
-private:
- Base m_cursor;
-};
-
//TODO: Put somewhere else?
template <class Value>
struct metadata {
@@ -431,4 +196,4 @@
} // namespace tree
} // namespace boost
-#endif // BOOST_TREE_CURSOR_HELPERS_HPP
+#endif // BOOST_TREE_CURSOR_FACADE_HPP
Deleted: sandbox/SOC/2006/tree/trunk/boost/tree/cursor_helpers.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/cursor_helpers.hpp 2008-06-27 13:36:03 EDT (Fri, 27 Jun 2008)
+++ (empty file)
@@ -1,434 +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_helpers.hpp
- * Cursor facade and adaptor implementations
- */
-
-// TODO: Use TR1 type_traits (integral_constant)
-
-#ifndef BOOST_TREE_CURSOR_HELPERS_HPP
-#define BOOST_TREE_CURSOR_HELPERS_HPP
-
-#include <boost/tree/cursor.hpp>
-
-#include <boost/iterator/iterator_facade.hpp>
-#include <boost/iterator/iterator_adaptor.hpp>
-
-#include <boost/type_traits/integral_constant.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/type_traits/is_convertible.hpp>
-#include <boost/utility/enable_if.hpp>
-
-#include <iterator>
-#include <utility>
-
-namespace boost {
-namespace tree {
-
-using boost::iterator_core_access;
-
-class cursor_core_access {
- public:
-
- friend class iterator_core_access;
-
- template <class Facade>
- static bool empty_(Facade const& f)
- {
- return f.empty_();
- }
-
- template <class Facade>
- static typename Facade::size_type size_(Facade const& f)
- {
- return f.size_();
- }
-
- template <class Facade>
- static typename Facade::size_type max_size_(Facade const& f)
- {
- return f.max_size_();
- }
-
- template <class Facade>
- static typename Facade::size_type par(Facade const& f)
- {
- return f.par();
- }
-
- template <class Facade>
- static void left(Facade& f)
- {
- f.left();
- }
-
- template <class Facade>
- static void right(Facade& f)
- {
- f.right();
- }
-
- //only if ascending
- template <class Facade>
- static void up(Facade& f)
- {
- f.up();
- }
-
-private:
- cursor_core_access();
-};
-
-template <
- class Derived // The derived cursor type being constructed
- , class Value
- , class HorizontalCategoryOrTraversal
- , class VerticalCategoryOrTraversal
- , class Reference = Value&
- , class Difference = std::ptrdiff_t
- , class Size = std::size_t
->
-class cursor_facade
- : public iterator_facade<Derived, Value, HorizontalCategoryOrTraversal,
- Reference, Difference> {
- private:
- // Curiously Recurring Template interface.
-
- Derived& derived()
- {
- return *static_cast<Derived*>(this);
- }
-
- Derived const& derived() const
- {
- return *static_cast<Derived const*>(this);
- }
-
- typedef typename cursor_facade::iterator_facade_ iterator_facade_;
-
- protected:
- // For use by derived classes
- typedef cursor_facade<Derived, Value, HorizontalCategoryOrTraversal,
- VerticalCategoryOrTraversal, Reference, Difference>
- cursor_facade_;
- public:
- typedef typename iterator_facade_::value_type value_type;
- typedef Reference reference;
- typedef Difference difference_type;
- typedef typename iterator_facade_::pointer pointer;
- typedef typename iterator_facade_::iterator_category iterator_category;
-
- typedef Size size_type;
-
- typedef bidirectional_traversal_tag cursor_category; //TODO
- typedef typename
- iterator_category_to_traversal<iterator_category>::type
- horizontal_traversal;
- typedef typename
- iterator_category_to_traversal<VerticalCategoryOrTraversal>::type
- vertical_traversal;
-
- bool const empty() const
- {
- return cursor_core_access::empty_(this->derived());
- }
-
- size_type const size() const
- {
- return cursor_core_access::size_(this->derived());
- }
-
- size_type const max_size() const
- {
- return cursor_core_access::max_size_(this->derived());
- }
-
- size_type const parity() const
- {
- return cursor_core_access::par(this->derived());
- }
-
- Derived& to_begin()
- {
- cursor_core_access::left(this->derived());
- return this->derived();
- }
-
- Derived begin()
- {
- Derived tmp(this->derived());
- return tmp.to_begin();
- }
-
- Derived& to_end()
- {
- cursor_core_access::right(this->derived());
- return this->derived();
- }
-
- Derived end()
- {
- Derived tmp(this->derived());
- return tmp.to_end();
- }
-
- Derived& to_parent()
- {
- cursor_core_access::up(this->derived());
- return this->derived();
- }
-
- Derived parent()
- {
- Derived tmp(this->derived());
- return tmp.to_parent();
- }
-};
-
-// We'll abuse iterator_adaptor to determine our types.
-template <
- class Derived
- , class Base
- , 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 eval_use_default
-: private iterator_adaptor<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , Reference
- , Difference>
-, private iterator_adaptor<Derived
- , Base
- , Value
- , VerticalTraversalOrCategory
- , Reference
- , Difference>
-{
-private:
- eval_use_default() {} // This class is used for typedefs only.
-
- typedef typename iterator_adaptor<Derived, Base, Value
- , HorizontalTraversalOrCategory, Reference
- , Difference>::super_t h_super_t;
- typedef typename iterator_adaptor<Derived, Base, Value
- , 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;
- typedef typename h_super_t::difference_type difference_type;
- typedef typename h_super_t::pointer pointer;
- typedef typename h_super_t::iterator_category iterator_category;
- typedef typename v_super_t::iterator_category vertical_traversal;
-
- // size_type isn't in iterator_adaptor,
- // so we have to calculate it on our own:
- typedef typename mpl::eval_if<
- is_same<Size, use_default>
- , boost::tree::cursor_size<Base>
- , mpl::identity<Size>
- >::type size_type;
-};
-
-template <
- class Derived
- , class Base
- , 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 cursor_adaptor
-: public cursor_facade<
- Derived
- , typename eval_use_default<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size>::value_type
- , typename eval_use_default<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size>::iterator_category
- , typename eval_use_default<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size>::vertical_traversal
- , typename eval_use_default<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size>::reference
- , typename eval_use_default<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size>::difference_type
- , typename eval_use_default<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size>::size_type>
-{
- friend class iterator_core_access;
- friend class cursor_core_access;
- typedef cursor_facade<Derived
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size> cursor_facade_;
-
- public:
- cursor_adaptor() {}
-
- explicit cursor_adaptor(Base const& cur) : m_cursor(cur)
- { }
-
- Base const& base() const
- { return m_cursor; }
-
- typedef typename cursor_facade_::iterator_category iterator_category;
-
- typedef typename cursor_facade_::horizontal_traversal horizontal_traversal;
- typedef typename cursor_facade_::vertical_traversal cursor_category;
-
- typedef Size size_type;
- typedef Base base_type;
-
- protected:
- typedef cursor_adaptor<Derived, Base, Value, HorizontalTraversalOrCategory,
- VerticalTraversalOrCategory, Reference, Difference,
- Size> cursor_adaptor_;
-
- typedef eval_use_default<Derived
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size> super_t;
-
- Base const& base_reference() const
- { return m_cursor; }
-
- Base& base_reference()
- { return m_cursor; }
-
- public:
-
- typename super_t::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
- {
- return m_cursor.empty();
- }
-
- size_type const size_() const
- {
- return m_cursor.size();
- }
-
- size_type const max_size_() const
- {
- return m_cursor.max_size();
- }
-
- size_type const par() const
- {
- return m_cursor.parity();
- }
-
- void left()
- {
- m_cursor.to_begin();
- }
-
- void right()
- {
- m_cursor.to_end();
- }
-
- void up()
- {
- m_cursor.to_parent();
- }
-
-private:
- Base m_cursor;
-};
-
-//TODO: Put somewhere else?
-template <class Value>
-struct metadata {
- struct type {};
-};
-
-} // namespace tree
-} // namespace boost
-
-#endif // BOOST_TREE_CURSOR_HELPERS_HPP
Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/cursor/forest.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/cursor/forest.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/cursor/forest.hpp 2008-06-27 13:36:03 EDT (Fri, 27 Jun 2008)
@@ -16,18 +16,11 @@
#ifndef BOOST_TREE_DETAIL_CURSOR_FOREST_HPP
#define BOOST_TREE_DETAIL_CURSOR_FOREST_HPP
-//#include <boost/tree/detail/cursor/nary.hpp>
-
#include <boost/tree/cursor.hpp>
-#include <boost/tree/cursor_helpers.hpp>
-
-//#include <boost/type_traits/integral_constant.hpp>
-//
-//#include <boost/type_traits/is_convertible.hpp>
-//#include <boost/utility/enable_if.hpp>
-//
-#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/tree/cursor_adaptor.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/utility/enable_if.hpp>
#include <iterator>
#include <utility>
@@ -39,76 +32,6 @@
using boost::tree::cursor_core_access;
using boost::iterator_core_access;
-//template <class Cursor>
-//class forest_cursor;
-//
-//template<class Cursor>
-//class const_forest_cursor
-// : public cursor_adaptor<const_forest_cursor<Cursor>
-// , Cursor const
-// , boost::use_default
-// , bidirectional_traversal_tag
-// , forward_traversal_tag
-// > {
-// private:
-// struct enabler {};
-//
-// public:
-// //TODO: Tidy up typedefs
-//
-// typedef Cursor base_cursor;
-//
-// typedef forest_cursor<Cursor> cursor;
-// typedef const_forest_cursor<Cursor> const_cursor;
-//
-// typedef typename cursor_size<base_cursor>::type size_type;
-//
-// typedef bidirectional_traversal_tag cursor_category;
-//
-// typedef typename Cursor::metadata_type metadata_type;
-//
-// // Container-specific:
-// typedef cursor iterator; // For (range) concepts' sake, mainly
-// typedef const_cursor const_iterator;
-//
-// // Common iterator facade stuff
-// const_forest_cursor()
-// : const_forest_cursor::cursor_adaptor_() {}
-//
-// explicit const_forest_cursor(base_cursor p)
-// : const_forest_cursor::cursor_adaptor_(p) {}
-//
-// template <class OtherCursor>
-// const_forest_cursor(
-// const_forest_cursor<OtherCursor> const& other
-// , typename boost::enable_if<
-// boost::is_convertible<OtherCursor*,
-// typename Cursor::base_pointer> // is that correct?
-// , enabler
-// >::type = enabler()
-// )
-// : const_forest_cursor::cursor_adaptor_(other.base()) {}
-//
-// operator base_cursor()
-// {
-// return this->base();
-// }
-// private:
-//
-// friend class boost::iterator_core_access;
-//
-// void increment()
-// {
-// (++this->base_reference()).to_begin();
-// }
-//
-// void decrement()
-// {
-// --this->base_reference().to_parent();
-// }
-//
-//};
-
template <class Cursor>
class forest_cursor
: public cursor_adaptor<forest_cursor<Cursor>
Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/cursor/multiway.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/cursor/multiway.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/cursor/multiway.hpp 2008-06-27 13:36:03 EDT (Fri, 27 Jun 2008)
@@ -12,15 +12,10 @@
#include <boost/tree/detail/cursor/nary.hpp>
#include <boost/tree/cursor.hpp>
-#include <boost/tree/cursor_helpers.hpp>
-
-//#include <boost/type_traits/integral_constant.hpp>
-//
-//#include <boost/type_traits/is_convertible.hpp>
-//#include <boost/utility/enable_if.hpp>
-//
-//#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/tree/cursor_adaptor.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/utility/enable_if.hpp>
#include <iterator>
#include <utility>
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-06-27 13:36:03 EDT (Fri, 27 Jun 2008)
@@ -13,7 +13,7 @@
#define BOOST_TREE_DETAIL_CURSOR_NARY_HPP
-#include <boost/tree/cursor_helpers.hpp>
+#include <boost/tree/cursor_facade.hpp>
#include <boost/tree/detail/node/nary.hpp>
#include <boost/mpl/eval_if.hpp>
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