$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: asutton_at_[hidden]
Date: 2008-07-05 08:25:59
Author: asutton
Date: 2008-07-05 08:25:58 EDT (Sat, 05 Jul 2008)
New Revision: 47105
URL: http://svn.boost.org/trac/boost/changeset/47105
Log:
Recovering implementations after restructuring.
Added:
   sandbox/SOC/2008/graphs/branches/descrip/descriptors/
   sandbox/SOC/2008/graphs/branches/descrip/descriptors/index_descriptor.hpp   (contents, props changed)
   sandbox/SOC/2008/graphs/branches/descrip/descriptors/node_descriptor.hpp   (contents, props changed)
Text files modified: 
   sandbox/SOC/2008/graphs/branches/descrip/containers.hpp  |     8 +++-----                                
   sandbox/SOC/2008/graphs/branches/descrip/des.cpp         |     4 ++--                                    
   sandbox/SOC/2008/graphs/branches/descrip/descriptors.hpp |    40 ++++++++++++++++++++--------------------
   3 files changed, 25 insertions(+), 27 deletions(-)
Modified: sandbox/SOC/2008/graphs/branches/descrip/containers.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/branches/descrip/containers.hpp	(original)
+++ sandbox/SOC/2008/graphs/branches/descrip/containers.hpp	2008-07-05 08:25:58 EDT (Sat, 05 Jul 2008)
@@ -1,4 +1,4 @@
-(C) Copyright 2004 Jeremy Siek
+// (C) Copyright 2004 Jeremy Siek
 //  (C) Copyright 2008 Andrew Sutton
 //  Distributed under the Boost Software License, Version 1.0. (See
 //  accompanying file LICENSE_1_0.txt or copy at
@@ -237,8 +237,6 @@
     inline typename Container::iterator
     erase(Container& c, typename Container::iterator i, associative_container_tag)
     {
-        // A little weird, but preserves the semantics of the sequence erase,
-        // although this doesn't actually mean anything.
         typename Container::iterator j = ++i;
         c.erase(i);
         return j;
@@ -251,8 +249,8 @@
 { return dispatch::insert(c, x, container_category(c)); }
 
 template <typename Container, typename T>
-inline typename C::iterator
-erase(Contaienr& c, typename Container::iterator i)
+inline typename Container::iterator
+erase(Container& c, typename Container::iterator i)
 { return dispatch::erase(c, i, container_category(c)); }
 
 #if 0
Modified: sandbox/SOC/2008/graphs/branches/descrip/des.cpp
==============================================================================
--- sandbox/SOC/2008/graphs/branches/descrip/des.cpp	(original)
+++ sandbox/SOC/2008/graphs/branches/descrip/des.cpp	2008-07-05 08:25:58 EDT (Sat, 05 Jul 2008)
@@ -39,8 +39,8 @@
 {
     typedef typename container_traits<Container>::category Category;
     typedef typename container_traits<Container>::iterator_stability IteratorStability;
-    typedef typename extended_container_traits<Container>::descriptor_type Descriptor;
-    typedef typename extended_container_traits<Container>::descriptor_stability DescriptorStability;
+    typedef typename descriptor_traits<Container>::descriptor_type Descriptor;
+    typedef typename descriptor_traits<Container>::descriptor_stability DescriptorStability;
 
     cout << "--- " << demangle<Container>() << " ---" << endl;
     cout << "category: " << demangle<Category>() << endl;
Modified: sandbox/SOC/2008/graphs/branches/descrip/descriptors.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/branches/descrip/descriptors.hpp	(original)
+++ sandbox/SOC/2008/graphs/branches/descrip/descriptors.hpp	2008-07-05 08:25:58 EDT (Sat, 05 Jul 2008)
@@ -3,14 +3,14 @@
 #define DESCRIPTORS_HPP
 
 // Pull the container traits.
-#include "containerss.hpp"
+#include "containers.hpp"
 
 // Some descriptors are built on blobs.
 #include "blob.hpp"
 
 // Descriptor implementations.
-#include "descriptor/node_descriptor.hpp"
-#include "descriptor/index_descriptor.hpp"
+#include "descriptors/node_descriptor.hpp"
+#include "descriptors/index_descriptor.hpp"
 
 // Descriptors Take 2 (or 3 or 4).
 //
@@ -87,9 +87,9 @@
  * be at least as long as the iterator, generally longer.
  */
 template <typename Container>
-inline typename extended_container_traits<Container>::descriptor_type
+inline typename descriptor_traits<Container>::descriptor_type
 make_descriptor(Container& c, typename Container::iterator i)
-{ return typename extended_container_traits<Container>::descriptor_type(c, i); }
+{ return typename descriptor_traits<Container>::descriptor_type(c, i); }
 
 /**
  * Given a container and a valid descriptor, return an iterator pointing to the
@@ -98,15 +98,15 @@
  */
 template <typename Container>
 inline typename Container::iterator
-make_iterator(Container& c, typename extended_container_traits<Container>::descriptor_type d)
+make_iterator(Container& c, typename descriptor_traits<Container>::descriptor_type d)
 { return d.get(c); }
 
 
 /** Return the descriptor stability tag for the given container. */
 template <typename Container>
-inline typename extended_container_traits<Container>::descriptor_stability
+inline typename descriptor_traits<Container>::descriptor_stability
 descriptor_stability(Container const&)
-{ return typename extended_container_traits<Container>::descriptor_stability(); }
+{ return typename descriptor_traits<Container>::descriptor_stability(); }
 
 // Metafunctions
 
@@ -120,7 +120,7 @@
     // True if not convertible to unstable_insert_tag.
     static bool const value =
         !boost::is_convertible<
-            typename extended_container_traits<Container>::descriptor_stability,
+            typename descriptor_traits<Container>::descriptor_stability,
             unstable_insert_tag
         >::value;
 };
@@ -135,7 +135,7 @@
     // True if not convertible to unstable_remove_tag.
     static bool const value =
         !boost::is_convertible<
-            typename extended_container_traits<Container>::descriptor_stability,
+            typename descriptor_traits<Container>::descriptor_stability,
             unstable_remove_tag
         >::value;
 };
@@ -146,7 +146,7 @@
 template <typename T, typename Alloc>
 struct descriptor_traits<std::vector<T, Alloc>>
 {
-    typedef index_descriptor<std::vector<T, Alloc>> descriptor_type;
+    typedef index_descriptor<typename std::vector<T, Alloc>::size_type> descriptor_type;
     typedef unstable_remove_tag descriptor_stability;
 };
 
@@ -154,7 +154,7 @@
 template <typename T, typename Alloc>
 struct descriptor_traits<std::list<T, Alloc>>
 {
-    typedef blob<sizeof(typename std::list<T, Alloc>::iterator)> descriptor_type;
+    typedef node_descriptor<blob<sizeof(typename std::list<T, Alloc>::iterator)>> descriptor_type;
     typedef stable_descriptor_tag descriptor_stability;
 };
 
@@ -162,33 +162,33 @@
 
 // Set
 template <typename T, typename Compare, typename Alloc>
-struct extended_container_traits<std::set<T, Compare, Alloc>>
+struct descriptor_traits<std::set<T, Compare, Alloc>>
 {
-    typedef blob<sizeof(typename std::set<T, Compare, Alloc>::iterator)> descriptor_type;
+    typedef node_descriptor<blob<sizeof(typename std::set<T, Compare, Alloc>::iterator)>> descriptor_type;
     typedef stable_descriptor_tag descriptor_stability;
 };
 
 // Multiset
 template <typename T, typename Compare, typename Alloc>
-struct extended_container_traits<std::multiset<T, Compare, Alloc>>
+struct descriptor_traits<std::multiset<T, Compare, Alloc>>
 {
-    typedef typename blob<sizeof(typename std::multiset<T, Compare, Alloc>::iterator)> descriptor_type;
+    typedef node_descriptor<blob<sizeof(typename std::multiset<T, Compare, Alloc>::iterator)>> descriptor_type;
     typedef stable_descriptor_tag descriptor_stability;
 };
 
 // Map
 template <typename K, typename T, typename Compare, typename Alloc>
-struct extended_container_traits<std::map<K, T, Compare, Alloc>>
+struct descriptor_traits<std::map<K, T, Compare, Alloc>>
 {
-    typedef blob<sizeof(typename std::map<T, K, Compare, Alloc>::iterator)> descriptor_type;
+    typedef node_descriptor<blob<sizeof(typename std::map<T, K, Compare, Alloc>::iterator)>> descriptor_type;
     typedef stable_descriptor_tag descriptor_stability;
 };
 
 // Multimap
 template <typename K, typename T, typename Compare, typename Alloc>
-struct extended_container_traits<std::multimap<K, T, Compare, Alloc>>
+struct descriptor_traits<std::multimap<K, T, Compare, Alloc>>
 {
-    typedef blob<sizeof(typename std::multimap<T, K, Compare, Alloc>::iterator)> descriptor_type;
+    typedef node_descriptor<blob<sizeof(typename std::multimap<T, K, Compare, Alloc>::iterator)>> descriptor_type;
     typedef stable_descriptor_tag descriptor_stability;
 };
 
Added: sandbox/SOC/2008/graphs/branches/descrip/descriptors/index_descriptor.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2008/graphs/branches/descrip/descriptors/index_descriptor.hpp	2008-07-05 08:25:58 EDT (Sat, 05 Jul 2008)
@@ -0,0 +1,71 @@
+
+#ifndef INDEX_DESCRIPTOR_HPP
+#define INDEX_DESCRIPTOR_HPP
+
+#include <boost/functional/hash.hpp>
+
+/**
+ * The index_descriptor simply maintains the descriptor as an index into the
+ * given offset.
+ */
+template <typename Index>
+struct index_descriptor
+{
+    typedef Index descriptor_type;
+
+    inline index_descriptor()
+        : value(-1)
+    { }
+
+    inline index_descriptor(descriptor_type d)
+        : value(d)
+    { }
+
+    template <typename Container>
+    inline index_descriptor(Container& c, typename Container::iterator i)
+        : value(std::distance(c.begin(), i))
+    { }
+
+    inline bool is_null() const
+    { return value == descriptor_type(-1); }
+
+    /** @name Equality Comparable */
+    //@{
+    inline bool operator==(index_descriptor const& x)
+    { return value == x.value; }
+
+    inline bool operator!=(index_descriptor const& x)
+    { return value != x.value; }
+    //@}
+
+    /** @name Less Than Comparable */
+    //@{
+    inline bool operator<(index_descriptor const& x)
+    { return value < x.value; }
+
+    inline bool operator>(index_descriptor const& x)
+    { return value > x.value; }
+
+    inline bool operator<=(index_descriptor const& x)
+    { return value <= x.value; }
+
+    inline bool operator>=(index_descriptor const& x)
+    { return value >= x.value; }
+    //@}
+
+    template <typename Container>
+    inline typename Container::iterator get(Container& c) const
+    { return std::next(c.begin(), value); }
+
+    descriptor_type value;
+};
+
+// A hash function for indexed descriptors.
+template <typename Index>
+std::size_t hash_value(index_descriptor<Index> const& x)
+{
+    using boost::hash_value;
+    return hash_value(x.value);
+}
+
+#endif
Added: sandbox/SOC/2008/graphs/branches/descrip/descriptors/node_descriptor.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2008/graphs/branches/descrip/descriptors/node_descriptor.hpp	2008-07-05 08:25:58 EDT (Sat, 05 Jul 2008)
@@ -0,0 +1,62 @@
+
+#ifndef VECTOR_DESCRIPTOR_HPP
+#define VECTOR_DESCRIPTOR_HPP
+
+/**
+ * The node descriptor contains an iterator into the target container. The
+ * container iterator is just a pattern for the actual iterator and has no
+ * real type (it's opaque).
+ */
+template <typename Blob>
+struct node_descriptor
+{
+    typedef Blob descriptor_type;
+
+    inline node_descriptor()
+        : value()
+    { }
+
+    inline node_descriptor(descriptor_type const& x)
+        : value(x)
+    { }
+
+    template <typename Container>
+    inline node_descriptor(Container&, typename Container::iterator i)
+        : value(i)
+    { }
+
+    inline bool is_null()
+    { return value == descriptor_type(); }
+
+    /** @name Equality Comparable */
+    //@{
+    inline bool operator==(node_descriptor const& x)
+    { return value == x.value; }
+
+    inline bool operator!=(node_descriptor const& x)
+    { return value != x.value; }
+    //@}
+
+    /** @name Less Than Comparable */
+    //@{
+    inline bool operator<(node_descriptor const& x)
+    { return value < x.value; }
+
+    inline bool operator>(node_descriptor const& x)
+    { return value > x.value; }
+
+    inline bool operator<=(node_descriptor const& x)
+    { return value <= x.value; }
+
+    inline bool operator>=(node_descriptor const& x)
+    { return value >= x.value; }
+    //@}
+
+    template <typename Container>
+    inline typename Container::iterator get(Container& c) const
+    { return value.get<typename Container::iterator>(); }
+
+    descriptor_type value;
+};
+
+#endif