|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r48828 - sandbox/SOC/2006/tree/trunk/boost/tree
From: ockham_at_[hidden]
Date: 2008-09-17 18:05:39
Author: bernhard.reiter
Date: 2008-09-17 18:05:38 EDT (Wed, 17 Sep 2008)
New Revision: 48828
URL: http://svn.boost.org/trac/boost/changeset/48828
Log:
Replace tabs by spaces.
Text files modified:
sandbox/SOC/2006/tree/trunk/boost/tree/cursor.hpp | 138 +++++++++---------
sandbox/SOC/2006/tree/trunk/boost/tree/cursor_adaptor.hpp | 292 ++++++++++++++++++++--------------------
sandbox/SOC/2006/tree/trunk/boost/tree/cursor_facade.hpp | 268 ++++++++++++++++++------------------
sandbox/SOC/2006/tree/trunk/boost/tree/forest_tree.hpp | 138 +++++++++---------
sandbox/SOC/2006/tree/trunk/boost/tree/graph.hpp | 76 +++++-----
5 files changed, 456 insertions(+), 456 deletions(-)
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-17 18:05:38 EDT (Wed, 17 Sep 2008)
@@ -27,58 +27,58 @@
template <class Cursor>
struct cursor_value {
- typedef typename Cursor::value_type type;
+ typedef typename Cursor::value_type type;
};
template <class Cursor>
struct cursor_reference {
- typedef typename Cursor::reference type;
+ typedef typename Cursor::reference type;
};
template <class Cursor>
struct cursor_const_reference {
- typedef typename Cursor::const_reference type;
+ typedef typename Cursor::const_reference type;
};
template <class Cursor>
struct cursor_pointer {
- typedef typename Cursor::pointer type;
+ typedef typename Cursor::pointer type;
};
template <class Cursor>
struct cursor_difference {
- typedef typename Cursor::difference_type type;
+ typedef typename Cursor::difference_type type;
};
template <class Cursor>
struct cursor_size {
- typedef typename Cursor::size_type type;
+ typedef typename Cursor::size_type type;
};
template <class Cursor>
struct cursor_category {
- typedef typename Cursor::cursor_category type;
+ typedef typename Cursor::cursor_category type;
};
template <class Cursor>
struct cursor_horizontal_traversal {
- typedef typename Cursor::horizontal_traversal type;
+ typedef typename Cursor::horizontal_traversal type;
};
template <class Cursor>
struct cursor_vertical_traversal {
- typedef typename Cursor::vertical_traversal type;
+ typedef typename Cursor::vertical_traversal type;
};
template <class Cat, class T, class Dist = ptrdiff_t, class Size = size_t,
- class Ptr = T*, class Ref = T&>
+ class Ptr = T*, class Ref = T&>
struct cursor {
- typedef Cat cursor_category;
- typedef T value_type;
- typedef Dist difference_type;
- typedef Size size_type;
- typedef Ptr pointer;
- typedef Ref reference;
+ typedef Cat cursor_category;
+ typedef T value_type;
+ typedef Dist difference_type;
+ typedef Size size_type;
+ typedef Ptr pointer;
+ typedef Ref reference;
};
// Deprecate?
@@ -86,24 +86,24 @@
struct descending_tag {};
struct descending_cursor_tag
- : public cursor_tag, public descending_tag,
- public input_iterator_tag, public output_iterator_tag {};
+ : public cursor_tag, public descending_tag,
+ public input_iterator_tag, public output_iterator_tag {};
struct descending_forward_cursor_tag
- : public cursor_tag, public descending_tag, public forward_iterator_tag {};
+ : public cursor_tag, public descending_tag, public forward_iterator_tag {};
struct descending_bidirectional_cursor_tag
- : public cursor_tag, public descending_tag, public bidirectional_iterator_tag {};
+ : public cursor_tag, public descending_tag, public bidirectional_iterator_tag {};
struct descending_random_access_cursor_tag
- : public cursor_tag, public descending_tag, public random_access_iterator_tag {};
+ : public cursor_tag, public descending_tag, public random_access_iterator_tag {};
struct ascending_tag {};
struct ascending_cursor_tag
- : public descending_cursor_tag, public ascending_tag {};
+ : public descending_cursor_tag, public ascending_tag {};
struct ascending_forward_cursor_tag
- : public descending_forward_cursor_tag, public ascending_tag {};
+ : public descending_forward_cursor_tag, public ascending_tag {};
struct ascending_bidirectional_cursor_tag
- : public descending_bidirectional_cursor_tag, public ascending_tag {};
+ : public descending_bidirectional_cursor_tag, public ascending_tag {};
struct ascending_random_access_cursor_tag
- : public descending_random_access_cursor_tag, public ascending_tag {};
+ : public descending_random_access_cursor_tag, public ascending_tag {};
/*
template <class Hor, class Vert>
@@ -111,7 +111,7 @@
template <>
struct produce_cursor_category<> {
- typedef descending_cursor_tag type;
+ typedef descending_cursor_tag type;
};
*/
@@ -130,52 +130,52 @@
template<class OutputIterator>
class output_cursor_iterator_wrapper {
protected:
- OutputIterator* iter;
+ OutputIterator* iter;
public:
- /// Make the iterator type publicly accessible.
- typedef OutputIterator iterator;
-
- /**
- * For construction, we obviously need an Output Iterator to work on (i.e., write to).
- */
- explicit output_cursor_iterator_wrapper(OutputIterator& i) : iter(&i) {}
-
- /**
- * @param value A const& value of the value_type of container that iter is
- * associated with.
- * @return This cursor, for chained operations.
- * Assigning a value to this cursor will insert it before iter, the iterator it is
- * wrapped around.
- *
- * Unfortunately, Output Iterators do not necessarily expose their
- * value_type (they might just give back void), so the following assignment operator
- * has to be a template.
- */
- // TODO: Consult C++0x if this has been changed
- template <class ValueType>
- output_cursor_iterator_wrapper& operator=(ValueType const& value)
- {
- *((*iter)++) = value;
- return *this;
- }
-
- /// Returns *this.
- output_cursor_iterator_wrapper& operator*() { 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; }
+ /// Make the iterator type publicly accessible.
+ typedef OutputIterator iterator;
+
+ /**
+ * For construction, we obviously need an Output Iterator to work on (i.e., write to).
+ */
+ explicit output_cursor_iterator_wrapper(OutputIterator& i) : iter(&i) {}
+
+ /**
+ * @param value A const& value of the value_type of container that iter is
+ * associated with.
+ * @return This cursor, for chained operations.
+ * Assigning a value to this cursor will insert it before iter, the iterator it is
+ * wrapped around.
+ *
+ * Unfortunately, Output Iterators do not necessarily expose their
+ * value_type (they might just give back void), so the following assignment operator
+ * has to be a template.
+ */
+ // TODO: Consult C++0x if this has been changed
+ template <class ValueType>
+ output_cursor_iterator_wrapper& operator=(ValueType const& value)
+ {
+ *((*iter)++) = value;
+ return *this;
+ }
+
+ /// Returns *this.
+ output_cursor_iterator_wrapper& operator*() { 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; }
};
/**
- * @param o An output iterator.
- * @result An instance of output_cursor_iterator_wrapper working on o.
+ * @param o An output iterator.
+ * @result An instance of output_cursor_iterator_wrapper working on o.
*
* Use as shortcut for cumbersome typenames, just as with std::inserter and the like.
*/
@@ -183,7 +183,7 @@
inline output_cursor_iterator_wrapper<OutputIterator>
outputter_cursor_iterator_wrapper(OutputIterator o)
{
- return output_cursor_iterator_wrapper<OutputIterator>(o);
+ return output_cursor_iterator_wrapper<OutputIterator>(o);
}
//define freestanding begin, end, size, empty using cursor's member fns?
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-17 18:05:38 EDT (Wed, 17 Sep 2008)
@@ -32,114 +32,114 @@
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;
- typedef typename iterator_adaptor<Derived, Base, Value
- , VerticalTraversalOrCategory, Reference
- , Difference>::super_t v_super_t;
+ 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;
+ 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;
-
- typedef cursor_facade<Derived
- , value_type
- , iterator_category
- , vertical_traversal
- , reference
- , difference_type
- , size_type> type;
+ 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;
+
+ typedef cursor_facade<Derived
+ , value_type
+ , iterator_category
+ , vertical_traversal
+ , reference
+ , difference_type
+ , size_type> type;
};
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
- , Base
- , Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size >::type
+ , Base
+ , Value
+ , HorizontalTraversalOrCategory
+ , VerticalTraversalOrCategory
+ , Reference
+ , Difference
+ , Size >::type
{
protected:
typedef cursor_adaptor<Derived, Base, Value, HorizontalTraversalOrCategory,
- VerticalTraversalOrCategory, Reference, Difference,
- Size> cursor_adaptor_;
-
- typedef typename cursor_adaptor_base<Derived, Base, Value
- , HorizontalTraversalOrCategory
- , VerticalTraversalOrCategory
- , Reference
- , Difference
- , Size>::type cursor_facade_;
-
- Base const& base_reference() const
- { return m_cursor; }
-
- Base& base_reference()
- { return m_cursor; }
-
+ VerticalTraversalOrCategory, Reference, Difference,
+ Size> cursor_adaptor_;
+
+ typedef typename cursor_adaptor_base<Derived, Base, Value
+ , HorizontalTraversalOrCategory
+ , VerticalTraversalOrCategory
+ , Reference
+ , Difference
+ , Size>::type cursor_facade_;
+
+ Base const& base_reference() const
+ { return m_cursor; }
+
+ Base& base_reference()
+ { return m_cursor; }
+
private:
- Base m_cursor;
-
- friend class iterator_core_access;
- friend class cursor_core_access;
+ Base m_cursor;
+
+ friend class iterator_core_access;
+ friend class cursor_core_access;
public:
- typedef Base base_type;
-
- typedef typename cursor_facade_::iterator_category iterator_category;
+ typedef Base base_type;
+
+ 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 typename cursor_facade_::size_type size_type;
+ typedef typename cursor_facade_::size_type size_type;
cursor_adaptor() {}
@@ -149,71 +149,71 @@
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
- {
- 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();
- }
+ 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
+ {
+ 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();
+ }
};
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-17 18:05:38 EDT (Wed, 17 Sep 2008)
@@ -32,53 +32,53 @@
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();
- }
+ 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();
+ cursor_core_access();
};
template <
@@ -88,109 +88,109 @@
, class VerticalCategoryOrTraversal
, class Reference = Value&
, class Difference = std::ptrdiff_t
- , class Size = std::size_t
+ , class Size = std::size_t
>
class cursor_facade
: public iterator_facade<Derived, Value, HorizontalCategoryOrTraversal,
- Reference, Difference> {
+ Reference, Difference> {
private:
- // Curiously Recurring Template interface.
+ // Curiously Recurring Template interface.
- Derived& derived()
- {
- return *static_cast<Derived*>(this);
- }
-
- Derived const& derived() const
- {
- return *static_cast<Derived const*>(this);
- }
+ 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_;
+ 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_;
+ // 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();
- }
+ 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();
+ }
};
//TODO: Put somewhere else?
template <class Value>
struct metadata {
- struct type {};
+ struct type {};
};
} // namespace tree
Modified: sandbox/SOC/2006/tree/trunk/boost/tree/forest_tree.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/forest_tree.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/forest_tree.hpp 2008-09-17 18:05:38 EDT (Wed, 17 Sep 2008)
@@ -35,78 +35,78 @@
*/
template <class T, class Hierarchy = binary_tree<T> >
class forest_tree {
- typedef forest_tree<T, Hierarchy> self_type;
+ typedef forest_tree<T, Hierarchy> self_type;
public:
- typedef T value_type;
- typedef Hierarchy hierarchy_type;
+ typedef T value_type;
+ typedef Hierarchy hierarchy_type;
- typedef typename hierarchy_type::cursor base_cursor;
- typedef typename hierarchy_type::const_cursor base_const_cursor;
-
- typedef forest_cursor<base_cursor> cursor;
- typedef forest_cursor<base_const_cursor> const_cursor;
-
- typedef typename cursor_pointer<cursor>::type pointer;
- typedef typename cursor_reference<cursor>::type reference;
- typedef typename cursor_size<cursor>::type size_type;
- typedef typename cursor_difference<cursor>::type difference_type;
-
-// forest_tree()
-// {
-// h.insert(h.root(), );
-// }
-
- explicit forest_tree(Hierarchy const& hier = Hierarchy()) : h(hier)
- { }
-
- bool empty()
- {
- return h.empty();
- }
-
- size_type size() const
- {
- return h.size();
- }
-
- /**
- * Returns a read/write ("mutable") cursor to the %binary_tree's root.
- */
- cursor root()
- {
- return cursor(h.root());
- }
-
- /**
- * Returns a read-only const_cursor to the %binary_tree's root.
- */
- const_cursor root() const
- {
- return croot();
- }
-
- /**
- * Returns a read-only const_cursor to the %binary_tree's root.
- */
- const_cursor croot() const
- {
- return const_cursor(h.croot());
- }
-
- cursor insert(cursor pos, value_type const& val)
- {
- // TODO: Could we remove the root-checking part if root.parent()
- // returned root? Or don't we even want root?
- base_cursor bc = base_cursor(pos);
- if (bc != h.root())
- bc = bc.parent();
- //if (bc.parity())
- return cursor(h.insert(bc, val));
- }
-
+ typedef typename hierarchy_type::cursor base_cursor;
+ typedef typename hierarchy_type::const_cursor base_const_cursor;
+
+ typedef forest_cursor<base_cursor> cursor;
+ typedef forest_cursor<base_const_cursor> const_cursor;
+
+ typedef typename cursor_pointer<cursor>::type pointer;
+ typedef typename cursor_reference<cursor>::type reference;
+ typedef typename cursor_size<cursor>::type size_type;
+ typedef typename cursor_difference<cursor>::type difference_type;
+
+// forest_tree()
+// {
+// h.insert(h.root(), );
+// }
+
+ explicit forest_tree(Hierarchy const& hier = Hierarchy()) : h(hier)
+ { }
+
+ bool empty()
+ {
+ return h.empty();
+ }
+
+ size_type size() const
+ {
+ return h.size();
+ }
+
+ /**
+ * Returns a read/write ("mutable") cursor to the %binary_tree's root.
+ */
+ cursor root()
+ {
+ return cursor(h.root());
+ }
+
+ /**
+ * Returns a read-only const_cursor to the %binary_tree's root.
+ */
+ const_cursor root() const
+ {
+ return croot();
+ }
+
+ /**
+ * Returns a read-only const_cursor to the %binary_tree's root.
+ */
+ const_cursor croot() const
+ {
+ return const_cursor(h.croot());
+ }
+
+ cursor insert(cursor pos, value_type const& val)
+ {
+ // TODO: Could we remove the root-checking part if root.parent()
+ // returned root? Or don't we even want root?
+ base_cursor bc = base_cursor(pos);
+ if (bc != h.root())
+ bc = bc.parent();
+ //if (bc.parity())
+ return cursor(h.insert(bc, val));
+ }
+
protected:
- hierarchy_type h;
-
+ hierarchy_type h;
+
};
Modified: sandbox/SOC/2006/tree/trunk/boost/tree/graph.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/graph.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/graph.hpp 2008-09-17 18:05:38 EDT (Wed, 17 Sep 2008)
@@ -35,15 +35,15 @@
template <class Cursor>
class out_edge_iterator
: public iterator_facade<out_edge_iterator<Cursor>
- , std::pair<Cursor, Cursor>
- , typename cursor_horizontal_traversal<Cursor>::type
- /*, Reference, Difference*/> {
+ , std::pair<Cursor, Cursor>
+ , typename cursor_horizontal_traversal<Cursor>::type
+ /*, Reference, Difference*/> {
- struct enabler {};
+ struct enabler {};
public:
- out_edge_iterator() : m_edge() {}
-
- explicit out_edge_iterator(Cursor u, Cursor v) : m_edge(u, v) {}
+ out_edge_iterator() : m_edge() {}
+
+ explicit out_edge_iterator(Cursor u, Cursor v) : m_edge(u, v) {}
template <class OtherCursor>
out_edge_iterator(
@@ -55,9 +55,9 @@
)
: m_edge(other.m_edge) {}
-
+
private:
- friend class boost::iterator_core_access;
+ friend class boost::iterator_core_access;
template <class OtherCursor>
bool equal(out_edge_iterator<OtherCursor> const& other) const
@@ -67,27 +67,27 @@
void increment()
{
- // We also need to account for the cursor's end()!
- if (m_edge.second == m_edge.first.end()) {
- m_edge.second = m_edge.first;
- return;
- }
- ++m_edge.second;
+ // We also need to account for the cursor's end()!
+ if (m_edge.second == m_edge.first.end()) {
+ m_edge.second = m_edge.first;
+ return;
+ }
+ ++m_edge.second;
}
void decrement()
{
- if (m_edge.second == m_edge.first) {
- m_edge.second = m_edge.first.end();
- return;
- }
- --m_edge.second;
+ if (m_edge.second == m_edge.first) {
+ m_edge.second = m_edge.first.end();
+ return;
+ }
+ --m_edge.second;
}
std::pair<Cursor, Cursor>& dereference() const
{ return const_cast<std::pair<Cursor, Cursor>&>(m_edge); }
- std::pair<Cursor, Cursor> m_edge;
+ std::pair<Cursor, Cursor> m_edge;
};
} // namespace tree
@@ -101,22 +101,22 @@
struct graph_traits< binary_tree<Tp, Alloc> > {
typedef typename binary_tree<Tp, Alloc>::cursor vertex_descriptor;
typedef std::pair<vertex_descriptor
- , vertex_descriptor> edge_descriptor; // Might be tunable...
+ , vertex_descriptor> edge_descriptor; // Might be tunable...
- typedef boost::tree::out_edge_iterator<vertex_descriptor> out_edge_iterator;
+ typedef boost::tree::out_edge_iterator<vertex_descriptor> out_edge_iterator;
typedef directed_tag directed_category;
typedef disallow_parallel_edge_tag edge_parallel_category;
- typedef incidence_graph_tag traversal_category;
+ typedef incidence_graph_tag traversal_category;
typedef
- typename cursor_size<vertex_descriptor>::type
- vertices_size_type;
+ typename cursor_size<vertex_descriptor>::type
+ vertices_size_type;
typedef
- typename cursor_size<vertex_descriptor>::type
- edges_size_type;
+ typename cursor_size<vertex_descriptor>::type
+ edges_size_type;
typedef
- typename cursor_size<vertex_descriptor>::type
- degree_size_type;
+ typename cursor_size<vertex_descriptor>::type
+ degree_size_type;
};
//template <class Tp, class Alloc>
@@ -146,8 +146,8 @@
const binary_tree<Tp, Alloc>& g)
{
typedef
- typename graph_traits< binary_tree<Tp, Alloc> >::out_edge_iterator
- Iter;
+ typename graph_traits< binary_tree<Tp, Alloc> >::out_edge_iterator
+ Iter;
return std::make_pair(Iter(u, u.begin()), Iter(u, u));
}
@@ -161,15 +161,15 @@
}
template <
- class Cursor,
- class Op //= typename identity<typename boost::tree::cursor_value<Cursor>::type>
+ class Cursor,
+ class Op //= typename identity<typename boost::tree::cursor_value<Cursor>::type>
>
struct extract_property_map;
template <class Cursor, class Op>
class extract_property_map
: public boost::put_get_helper<typename Op::result_type&
- , extract_property_map<Cursor, Op> >
+ , extract_property_map<Cursor, Op> >
{
public:
typedef Cursor key_type;
@@ -177,11 +177,11 @@
typedef value_type& reference;
typedef boost::lvalue_property_map_tag category;
- extract_property_map(Op op = Op()) : m_op(op) {}
+ extract_property_map(Op op = Op()) : m_op(op) {}
inline reference operator[](key_type v) const
{
- return m_op(*v.to_begin());
+ return m_op(*v.to_begin());
}
private:
@@ -191,7 +191,7 @@
template <class Tree>
bool empty_cursor(typename Tree::cursor u, Tree)
{
- return u.empty();
+ return u.empty();
}
} // 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