$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: asutton_at_[hidden]
Date: 2007-09-04 13:40:55
Author: asutton
Date: 2007-09-04 13:40:54 EDT (Tue, 04 Sep 2007)
New Revision: 39117
URL: http://svn.boost.org/trac/boost/changeset/39117
Log:
Finished exploding the property map header - should help make the library
a little more accessible and less "opaque"
Added:
   sandbox/graph-v2/boost/property_map/
   sandbox/graph-v2/boost/property_map/archetypes.hpp   (contents, props changed)
   sandbox/graph-v2/boost/property_map/associative_property_map.hpp   (contents, props changed)
   sandbox/graph-v2/boost/property_map/concepts.hpp   (contents, props changed)
   sandbox/graph-v2/boost/property_map/constant_property_map.hpp   (contents, props changed)
   sandbox/graph-v2/boost/property_map/detail/
   sandbox/graph-v2/boost/property_map/detail/put_get_helper.hpp   (contents, props changed)
   sandbox/graph-v2/boost/property_map/dummy_property_map.hpp   (contents, props changed)
   sandbox/graph-v2/boost/property_map/identity_property_map.hpp   (contents, props changed)
   sandbox/graph-v2/boost/property_map/iterator_property_map.hpp   (contents, props changed)
   sandbox/graph-v2/boost/property_map/property_traits.hpp   (contents, props changed)
   sandbox/graph-v2/boost/property_map/reference_property_map.hpp   (contents, props changed)
Added: sandbox/graph-v2/boost/property_map/archetypes.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/boost/property_map/archetypes.hpp	2007-09-04 13:40:54 EDT (Tue, 04 Sep 2007)
@@ -0,0 +1,104 @@
+// (C) Copyright Jeremy Siek 1999-2001.
+// (C) Andrew Sutton 2007
+//
+// 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)
+
+#ifndef BOOST_PROPERTY_MAP_ARCHETYPES_HPP
+#define BOOST_PROPERTY_MAP_ARCHETYPES_HPP
+
+#include <boost/property_map/property_traits.hpp>
+#include <boost/concept_archetype.hpp>
+#include <boost/concept_check.hpp>
+
+namespace boost { namespace property_map {
+
+    // ReadablePropertyMap
+    // Supplies only the requisite get() function.
+    template <typename KeyArchetype, typename ValueArchetype>
+    struct readable_property_map_archetype
+    {
+        typedef KeyArchetype key_type;
+        typedef ValueArchetype value_type;
+        typedef convertible_to_archetype<ValueArchetype> reference;
+        typedef readable_property_map_tag category;
+    };
+
+    template <typename K, typename V>
+    const typename readable_property_map_archetype<K,V>::reference&
+    get(const readable_property_map_archetype<K,V>&,
+        const typename readable_property_map_archetype<K,V>::key_type&)
+    {
+        typedef typename readable_property_map_archetype<K,V>::reference Ref;
+        return static_object<Ref>::get();
+    }
+
+    // WritablePropertyMap
+    // Supplies only the requisite put() function.
+    template <typename KeyArchetype, typename ValueArchetype>
+    struct writable_property_map_archetype
+    {
+        typedef KeyArchetype key_type;
+        typedef ValueArchetype value_type;
+        typedef void reference;
+        typedef writable_property_map_tag category;
+    };
+
+    template <typename K, typename V>
+    void put(const writable_property_map_archetype<K,V>&,
+             const typename writable_property_map_archetype<K,V>::key_type&,
+             const typename writable_property_map_archetype<K,V>::value_type&)
+    { }
+
+
+    // ReadWritePropertyMap
+    // This pulls in both the put() and get() functions via inheritance.
+    template <typename KeyArchetype, typename ValueArchetype>
+    struct read_write_property_map_archetype
+        : public readable_property_map_archetype<KeyArchetype, ValueArchetype>
+        , public writable_property_map_archetype<KeyArchetype, ValueArchetype>
+    {
+        typedef KeyArchetype key_type;
+        typedef ValueArchetype value_type;
+        typedef convertible_to_archetype<ValueArchetype> reference;
+        typedef read_write_property_map_tag category;
+    };
+
+    // LvaluePropertyMap
+    // Index operator (operator []) returns a const reference to the value type
+    // and the get() function is inherited from the readable type.
+    template <typename KeyArchetype, typename ValueArchetype>
+    struct lvalue_property_map_archetype
+        : public readable_property_map_archetype<KeyArchetype, ValueArchetype>
+    {
+        typedef KeyArchetype key_type;
+        typedef ValueArchetype value_type;
+        typedef const ValueArchetype& reference;
+        typedef lvalue_property_map_tag category;
+
+        reference operator[](const key_type&) const
+        { return static_object<value_type>::get(); }
+    };
+
+    // MutableLvaluePropertyMap
+    // Index operator (operator []) returns a non-const reference to the value
+    // type. This also inherits the get() and put() from readable and writable
+    // concepts.
+    template <typename KeyArchetype, typename ValueArchetype>
+    struct mutable_lvalue_property_map_archetype
+        : public readable_property_map_archetype<KeyArchetype, ValueArchetype>
+        , public writable_property_map_archetype<KeyArchetype, ValueArchetype>
+    {
+        typedef KeyArchetype key_type;
+        typedef ValueArchetype value_type;
+        typedef ValueArchetype& reference;
+        typedef lvalue_property_map_tag category;
+
+        reference operator[](const key_type&) const
+        { return static_object<value_type>::get(); }
+    };
+
+} }
+
+#endif
Added: sandbox/graph-v2/boost/property_map/associative_property_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/boost/property_map/associative_property_map.hpp	2007-09-04 13:40:54 EDT (Tue, 04 Sep 2007)
@@ -0,0 +1,103 @@
+// (C) Copyright Jeremy Siek 1999-2001.
+// (C) Andrew Sutton 2007
+//
+// 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)
+
+#ifndef BOOST_PROPERTY_MAP_ASSOCIATIVE_PROPERTY_MAP_HPP
+#define BOOST_PROPERTY_MAP_ASSOCIATIVE_PROPERTY_MAP_HPP
+
+#include <boost/property_map/property_traits.hpp>
+#include <boost/property_map/concepts.hpp>
+#include <boost/property_map/detail/put_get_helper.hpp>
+
+namespace boost { namespace property_map {
+
+    // Associative property maps provide lookup capabilities for unique
+    // pair associative containers. There are actually two types here...
+    // A non-const variety and a const variety. The associated generator
+    // function will deduce the correct type to instantiate.
+
+    // Note that the non-const version may actually insert key/value pairs
+    // into to the underlying container if get()ing a key that isn't already
+    // in the map. The const version has undefined behavior if the key is not
+    // found (since it will try to access through end()).
+
+    template <typename Container>
+    class associative_property_map
+        : public put_get_helper<
+                typename Container::value_type::second_type&,
+                associative_property_map<Container>
+            >
+    {
+        typedef Container C;
+    public:
+        typedef typename Container::key_type key_type;
+        typedef typename Container::value_type::second_type value_type;
+        typedef value_type& reference;
+        typedef lvalue_property_map_tag category;
+
+        associative_property_map()
+            : m_container(0)
+        { }
+
+        associative_property_map(Container& c)
+            : m_container(&c)
+        { }
+
+        reference operator[](const key_type& k) const
+        { return (*m_container)[k]; }
+
+    private:
+        Container* m_container;
+    };
+
+    template <class Container>
+    inline associative_property_map<Container>
+    make_associative_property_map(Container& c)
+    {
+        return associative_property_map<Container>(c);
+    }
+
+
+
+    template <typename Container>
+    class const_associative_property_map
+        : public put_get_helper<
+                const typename Container::value_type::second_type&,
+                const_associative_property_map<Container>
+            >
+    {
+        typedef Container C;
+    public:
+        typedef typename Container::key_type key_type;
+        typedef typename Container::value_type::second_type value_type;
+        typedef const value_type& reference;
+        typedef lvalue_property_map_tag category;
+
+        const_associative_property_map()
+            : m_container(0)
+        { }
+
+        const_associative_property_map(const C& c)
+            : m_container(&c)
+        { }
+
+        reference operator[](const key_type& k) const
+        { return m_container->find(k)->second; }
+
+    private:
+        Container const* m_container;
+    };
+
+    template <class Container>
+    const_associative_property_map<Container>
+    make_associative_property_map(const Container& c)
+    {
+        return const_associative_property_map<Container>(c);
+    }
+
+} }
+
+#endif
Added: sandbox/graph-v2/boost/property_map/concepts.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/boost/property_map/concepts.hpp	2007-09-04 13:40:54 EDT (Tue, 04 Sep 2007)
@@ -0,0 +1,126 @@
+// (C) Copyright Jeremy Siek 1999-2001.
+// (C) Andrew Sutton 2007
+//
+// 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)
+
+#ifndef BOOST_PROPERTY_MAP_CONCEPTS_HPP
+#define BOOST_PROPERTY_MAP_CONCEPTS_HPP
+
+#include <boost/property_map/property_traits.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/concept_check.hpp>
+
+#include <boost/concept/detail/concept_def.hpp>
+namespace boost { namespace property_map {
+    namespace concepts {
+        BOOST_concept(ReadablePropertyMap, (PropertyMap)(Key))
+        {
+            typedef typename property_traits<PropertyMap>::key_type key_type;
+            typedef typename property_traits<PropertyMap>::reference reference;
+            typedef typename property_traits<PropertyMap>::category Category;
+            typedef typename property_traits<PropertyMap>::value_type Value;
+            typedef readable_property_map_tag ReadableTag;
+
+            BOOST_CONCEPT_USAGE(ReadablePropertyMap)
+            {
+                function_requires< ConvertibleConcept<Category, ReadableTag> >();
+                v = get(pmap, k);
+            }
+
+            PropertyMap pmap;
+            Key k;
+            Value v;
+        };
+
+        BOOST_concept(WritablePropertyMap, (PropertyMap)(Key))
+        {
+            typedef typename property_traits<PropertyMap>::key_type key_type;
+            typedef typename property_traits<PropertyMap>::category Category;
+            typedef typename property_traits<PropertyMap>::value_type Value;
+            typedef writable_property_map_tag WritableTag;
+
+            BOOST_CONCEPT_USAGE(WritablePropertyMap)
+            {
+                function_requires< ConvertibleConcept<Category, WritableTag> >();
+                put(pmap, k, v);
+            }
+
+            PropertyMap pmap;
+            Key k;
+            Value v;
+        };
+
+        BOOST_concept(ReadWritePropertyMap, (PropertyMap)(Key))
+        {
+            typedef typename property_traits<PropertyMap>::category Category;
+            typedef read_write_property_map_tag ReadWriteTag;
+
+            BOOST_CONCEPT_USAGE(ReadWritePropertyMap)
+            {
+                function_requires< ConvertibleConcept<Category, ReadWriteTag> >();
+                function_requires< ReadablePropertyMapConcept<PropertyMap, Key> >();
+                function_requires< WritablePropertyMapConcept<PropertyMap, Key> >();
+            }
+        };
+
+        BOOST_concept(LvaluePropertyMap, (PropertyMap)(Key))
+        {
+            typedef typename property_traits<PropertyMap>::value_type value_type;
+            typedef typename property_traits<PropertyMap>::reference reference;
+            typedef typename property_traits<PropertyMap>::category Category;
+            typedef lvalue_property_map_tag LvalueTag;
+
+            BOOST_CONCEPT_USAGE(LvaluePropertyMap)
+            {
+                function_requires< ConvertibleConcept<Category, LvalueTag> >();
+                function_requires< ReadablePropertyMapConcept<PropertyMap, Key> >();
+
+                BOOST_MPL_ASSERT((boost::mpl::or_<
+                                    boost::is_same<const value_type&, reference>,
+                                    boost::is_same<value_type&, reference> >));
+
+                reference ref = pmap[k];
+                ignore_unused_variable_warning(ref);
+            }
+
+            PropertyMap pmap;
+            Key k;
+        };
+
+        BOOST_concept(MutableLvaluePropertyMap, (PropertyMap)(Key))
+        {
+            typedef typename property_traits<PropertyMap>::value_type value_type;
+            typedef typename property_traits<PropertyMap>::reference reference;
+            typedef typename property_traits<PropertyMap>::category Category;
+            typedef lvalue_property_map_tag LvalueTag;
+
+            BOOST_CONCEPT_USAGE(MutableLvaluePropertyMap)
+            {
+                boost::function_requires< ReadWritePropertyMapConcept<PropertyMap, Key> >();
+                boost::function_requires<ConvertibleConcept<Category, LvalueTag> >();
+
+                BOOST_MPL_ASSERT((boost::is_same<value_type&, reference>));
+
+                reference ref = pmap[k];
+                ignore_unused_variable_warning(ref);
+            }
+
+            PropertyMap pmap;
+            Key k;
+        };
+
+    }
+
+    using concepts::ReadablePropertyMapConcept;
+    using concepts::WritablePropertyMapConcept;
+    using concepts::ReadWritePropertyMapConcept;
+    using concepts::LvaluePropertyMapConcept;
+    using concepts::MutableLvaluePropertyMapConcept;
+} }
+#include <boost/concept/detail/concept_undef.hpp>
+
+#endif
Added: sandbox/graph-v2/boost/property_map/constant_property_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/boost/property_map/constant_property_map.hpp	2007-09-04 13:40:54 EDT (Tue, 04 Sep 2007)
@@ -0,0 +1,53 @@
+// (C) Copyright Jeremy Siek 1999-2001.
+// (C) Andrew Sutton 2007
+//
+// 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)
+
+#ifndef BOOST_PROPERTY_MAP_CONSTANT_PROPERTY_MAP_HPP
+#define BOOST_PROPERTY_MAP_CONSTANT_PROPERTY_MAP_HPP
+
+#include <boost/property_map/property_traits.hpp>
+#include <boost/property_map/detail/put_get_helper.hpp>
+
+namespace boost { namespace property_map {
+
+    // The constant property map is nearly identical to the reference
+    // property map except that a) it can be constructed over an rvalue,
+    // and b) the returned value cannot be changed.
+
+    template <typename Key, typename Value>
+    struct constant_property_map
+    {
+        typedef Key key_type;
+        typedef Value value_type;
+        typedef const Value& reference;
+        typedef lvalue_property_map_tag category;
+
+        inline constant_property_map(const value_type& v)
+            : value(v)
+        { }
+
+        const value_type& value;
+    };
+
+    template <typename Key, typename Value>
+    inline const Value&
+    get(const constant_property_map<Key, Value>& pm, const Key&)
+    {
+        return pm.value;
+    }
+
+
+    // A generator function for creating const reference property maps.
+    template <typename Key, typename Value>
+    inline constant_property_map<Key, Value>
+    make_constant_property_map(const Value& v)
+    {
+        typedef constant_property_map<Key, Value> PropertyMap;
+        return PropertyMap(v);
+    }
+} }
+
+#endif
Added: sandbox/graph-v2/boost/property_map/detail/put_get_helper.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/boost/property_map/detail/put_get_helper.hpp	2007-09-04 13:40:54 EDT (Tue, 04 Sep 2007)
@@ -0,0 +1,43 @@
+// (C) Copyright Jeremy Siek 1999-2001.
+// (C) Andrew Sutton 2007
+//
+// 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)
+
+#ifndef BOOST_PROPERTY_MAP_DETAIL_PUT_GET_HELPER_HPP
+#define BOOST_PROPERTY_MAP_DETAIL_PUT_GET_HELPER_HPP
+
+namespace boost { namespace property_map {
+    // This helper class will automatically generate the put() and get()
+    // functions for a property map when instantiated with class that models
+    // the LvaluePropertyMap concept. Most of the property maps provided by
+    // this library use this class. Note that this class is actually empty,
+    // and is really only used to instantiate the put() and get() functions
+    // for the given LvaluePropertyMap.
+    //
+    // The Reference parameter should be the same as the return type of the
+    // operator[] on the LvaluePropertyMap and, in most cases should actually
+    // be a reference type (either const or not).
+    template <class Reference, class LvaluePropertyMap>
+    struct put_get_helper { };
+
+    template <class PropertyMap, class Reference, class K>
+    inline Reference
+    get(const put_get_helper<Reference, PropertyMap>& pg, const K& k)
+    {
+        const PropertyMap& pm = static_cast<const PropertyMap&>(pg);
+        Reference v = pm[k];
+        return v;
+    }
+
+    template <class PropertyMap, class Reference, class K, class V>
+    inline void
+    put(const put_get_helper<Reference, PropertyMap>& pg, K k, const V& v)
+    {
+        const PropertyMap& pm = static_cast<const PropertyMap&>(pg);
+        pm[k] = v;
+    }
+} }
+
+#endif
Added: sandbox/graph-v2/boost/property_map/dummy_property_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/boost/property_map/dummy_property_map.hpp	2007-09-04 13:40:54 EDT (Tue, 04 Sep 2007)
@@ -0,0 +1,45 @@
+// (C) Copyright Jeremy Siek 1999-2001.
+// (C) Andrew Sutton 2007
+//
+// 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)
+
+#ifndef BOOST_PROPERTY_MAP_DUMMY_PROPERTY_MAP_HPP
+#define BOOST_PROPERTY_MAP_DUMMY_PROPERTY_MAP_HPP
+
+#include <boost/property_map/property_traits.hpp>
+#include <boost/property_map/detail/put_get_helper.hpp>
+
+namespace boost { namespace property_map {
+
+    // The old description says, "when you have to supply a property map
+    // but don't need it". The only possible case that this covers is providing
+    // a map that can be written to, but doesn't actually do anything with the
+    // writes.
+
+    // The dummy property map basically consumes put()s. Although it's
+    // fully an lvalue property map (and supports get()s as well), not
+    // algorithm should rely on the returned values from either accessor.
+
+    // NOTE: This no longer models neither the ReadablePropertyMap concept nor
+    // nor the LvaluePropertyMap concept.
+
+    template <typename Key, typename Value>
+    class dummy_property_map
+        : public put_get_helper< Value&, dummy_property_map<Key,Value> >
+    {
+    public:
+        typedef Key key_type;
+        typedef Value value_type;
+        typedef Value& reference;
+        typedef read_write_property_map_tag category;
+    };
+
+    template <typename Key, typename Value>
+    void put(dummy_property_map<Key, Value>& pm, const Key&, const Value&)
+    { }
+
+} }
+
+#endif
Added: sandbox/graph-v2/boost/property_map/identity_property_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/boost/property_map/identity_property_map.hpp	2007-09-04 13:40:54 EDT (Tue, 04 Sep 2007)
@@ -0,0 +1,54 @@
+// (C) Copyright Jeremy Siek 1999-2001.
+// (C) Andrew Sutton 2007
+//
+// 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)
+
+#ifndef BOOST_PROPERTY_MAP_IDENTITY_PROPERTY_MAP_HPP
+#define BOOST_PROPERTY_MAP_IDENTITY_PROPERTY_MAP_HPP
+
+#include <boost/property_map/property_traits.hpp>
+#include <boost/property_map/detail/put_get_helper.hpp>
+
+namespace boost { namespace property_map {
+
+    // The identity property map return has a key and value type of size_t
+    // and get() returns the same value that its given as an argument.
+
+    // NOTE: This class pretends to model the mutable lvalue property map. I
+    // don't think that "identity" is really a mutable concept, but I also don't
+    // think the identity of a non-cont reference is a const reference.
+    // However, the semantics are a little strange. Consider:
+    // pm[k] = v;       // sets k == v?
+    // It's legal, but it doesn't make a lot of sense. It may be worth removing
+    // these later if it turns out we don't need them.
+
+    template <typename Value>
+    struct identity_property_map
+    {
+        typedef Value key_type;
+        typedef Value value_type;
+        typedef const Value& reference;
+        typedef readable_property_map_tag category;
+
+        inline value_type& operator[](key_type& v) const
+        { return v; }
+
+        inline const value_type& operator[](const key_type& v) const
+        { return v; }
+    };
+
+    template <typename Value>
+    inline const Value&
+    get(const identity_property_map<Value>& pm, const Value& v)
+    { return v; }
+
+    template <typename Value>
+    inline Value&
+    get(const identity_property_map<Value>& pm, Value& v)
+    { return v; }
+
+} }
+
+#endif
Added: sandbox/graph-v2/boost/property_map/iterator_property_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/boost/property_map/iterator_property_map.hpp	2007-09-04 13:40:54 EDT (Tue, 04 Sep 2007)
@@ -0,0 +1,188 @@
+// (C) Copyright Jeremy Siek 1999-2001.
+// (C) Andrew Sutton 2007
+//
+// 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)
+
+#ifndef BOOST_PROPERTY_MAP_ITERATOR_PROPERTY_MAP_HPP
+#define BOOST_PROPERTY_MAP_ITERATOR_PROPERTY_MAP_HPP
+
+#include <boost/assert.hpp>
+#include <boost/detail/iterator.hpp>
+#include <boost/property_map/property_traits.hpp>
+#include <boost/property_map/concepts.hpp>
+#include <boost/property_map/detail/put_get_helper.hpp>
+
+namespace boost { namespace property_map {
+
+    // NOTE: This class depends on std::iterator_traits so we're going to
+    // refer back to boost::detail::iterator_traits for a correct implementation
+    // on all platforms (?).
+
+    // The iterator property map povides get() and put() functions for random
+    // access containers such that their random access iterators act as the
+    // key type for access.
+    //
+    // Iterator property maps rely on a index map (which is also a property map)
+    // that provides, via its get() function, an offset from the iterator supplied
+    // during construction of this property map. The index map generally gives
+    // a value who's type is convertible to the iterator's difference_type.
+    //
+    // This gives rise to one of the "stranger" aspects of the class - that its
+    // key type is the same as that of the IndexMap over which it is instantiated.
+    // The strange implication is that the indices represented by the index map
+    // must correspond to the offset from the initial iterator given in the
+    // constructor. The net result is that, if get(index, key) == i, then
+    // imap[key] returns a reference to the ith object past iter. The implication
+    // here is that the indices of objects are generally required to be in the
+    // range [0, n).
+    template <
+        class RandomAccessIterator,
+        class IndexMap,
+        class Type = typename boost::detail::iterator_traits<RandomAccessIterator>::value_type,
+        class Reference = typename boost::detail::iterator_traits<RandomAccessIterator>::reference
+    >
+    class iterator_property_map
+        : public put_get_helper<
+                Reference,
+                iterator_property_map<
+                        RandomAccessIterator,
+                        IndexMap,
+                        Type,
+                        Reference
+                    >
+                >
+    {
+    public:
+        typedef typename property_traits<IndexMap>::key_type key_type;
+        typedef Type value_type;
+        typedef Reference reference;
+        typedef lvalue_property_map_tag category;
+
+        inline iterator_property_map(RandomAccessIterator cc = RandomAccessIterator(),
+                                     const IndexMap& id = IndexMap())
+            : iter(cc)
+            , index(id)
+        { }
+
+        inline Reference operator[](key_type k) const
+        {
+            // If get(index, k) == i, return the ith offset past iter.
+            return *(iter + get(index, k)) ;
+        }
+
+    protected:
+        RandomAccessIterator iter;
+        IndexMap index;
+    };
+
+    // A generator function that constructs an interator property map given a
+    // random access iterator and an index map. The value type and reference
+    // type are those of the RandomAccessIterator type.
+    //
+    // NOTE: The requirement that IndexMap model the ReadablePropertyMap concept
+    // is somewhat "recursive" since it both defines and the key type for the
+    // property map being constructed and provides its type for the function.
+    template <class RandomAccessIterator, class IndexMap>
+    inline iterator_property_map<
+            RandomAccessIterator,
+            IndexMap,
+            typename boost::detail::iterator_traits<RandomAccessIterator>::value_type,
+            typename boost::detail::iterator_traits<RandomAccessIterator>::reference
+        >
+    make_iterator_property_map(RandomAccessIterator iter, IndexMap id)
+    {
+        function_requires< RandomAccessIteratorConcept<RandomAccessIterator> >();
+        function_requires< ReadablePropertyMapConcept<IndexMap, typename property_traits<IndexMap>::key_type> >();
+        typedef iterator_property_map<
+                RandomAccessIterator,
+                IndexMap,
+                typename boost::detail::iterator_traits<RandomAccessIterator>::value_type,
+                typename boost::detail::iterator_traits<RandomAccessIterator>::reference
+            > PropertyMap;
+        return PropertyMap(iter, id);
+    }
+
+    // Nearly identical to the iterator_property_map, this enforces the range
+    // constraint (mentioned above) for the values of the IndexMap. Specifically,
+    // this asserts at runtime that indices returned by the  index map fall
+    // within the range [0, n). I suspect that there's an implicit requirement
+    // that index types are unsigned.
+
+    template <
+        class RandomAccessIterator,
+        class IndexMap,
+        class Type = typename boost::detail::iterator_traits<RandomAccessIterator>::value_type,
+        class Reference = typename boost::detail::iterator_traits<RandomAccessIterator>::reference
+    >
+    class safe_iterator_property_map
+        : public put_get_helper<
+                Reference,
+                iterator_property_map<
+                        RandomAccessIterator,
+                        IndexMap,
+                        Type,
+                        Reference
+                    >
+                >
+    {
+    public:
+        typedef typename property_traits<IndexMap>::key_type key_type;
+        typedef Type value_type;
+        typedef Reference reference;
+        typedef lvalue_property_map_tag category;
+
+        inline safe_iterator_property_map(RandomAccessIterator first,
+                                          std::size_t n = 0,
+                                          const IndexMap& id = IndexMap())
+            : iter(first)
+            , num(n)
+            , index(id)
+        { }
+
+        inline safe_iterator_property_map()
+        { }
+
+        inline Reference operator[](key_type k) const
+        {
+            BOOST_ASSERT(get(index, k) < num);
+            return *(iter + get(index, k)) ;
+        }
+
+        inline typename property_traits<IndexMap>::value_type
+        size() const
+        { return num; }
+
+    protected:
+        typedef typename property_traits<IndexMap>::value_type Index;
+
+        RandomAccessIterator iter;
+        Index num;
+        IndexMap index;
+    };
+
+    // A generator function for creating safe iterator property maps.
+    template <class RandomAccessIterator, class IndexMap>
+    inline safe_iterator_property_map<
+            RandomAccessIterator,
+            IndexMap,
+            typename boost::detail::iterator_traits<RandomAccessIterator>::value_type,
+            typename boost::detail::iterator_traits<RandomAccessIterator>::reference
+        >
+    make_safe_iterator_property_map(RandomAccessIterator iter, std::size_t n, IndexMap id)
+    {
+        function_requires< RandomAccessIteratorConcept<RandomAccessIterator> >();
+        function_requires< ReadablePropertyMapConcept<IndexMap, typename property_traits<IndexMap>::key_type> >();
+        typedef safe_iterator_property_map<
+                RandomAccessIterator,
+                IndexMap,
+                typename boost::detail::iterator_traits<RandomAccessIterator>::value_type,
+                typename boost::detail::iterator_traits<RandomAccessIterator>::reference
+            > PropertyMap;
+
+        return PropertyMap(iter, n, id);
+    }
+} }
+
+#endif
Added: sandbox/graph-v2/boost/property_map/property_traits.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/boost/property_map/property_traits.hpp	2007-09-04 13:40:54 EDT (Tue, 04 Sep 2007)
@@ -0,0 +1,165 @@
+// (C) Copyright Jeremy Siek 1999-2001.
+// (C) Andrew Sutton 2007
+//
+// 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)
+
+#ifndef BOOST_PROPERTY_MAP_PROPERTY_TRAITS_HPP
+#define BOOST_PROPERTY_MAP_PROPERTY_TRAITS_HPP
+
+#include <cstddef>
+#include <boost/config.hpp>
+
+namespace boost { namespace property_map {
+
+    template <typename PropertyMap>
+    struct property_traits
+    {
+        typedef typename PropertyMap::key_type key_type;
+        typedef typename PropertyMap::value_type value_type;
+        typedef typename PropertyMap::reference reference;
+        typedef typename PropertyMap::category category;
+    };
+
+    namespace detail {
+        // This enumeration provides identifier values that can be used
+        // to determine the specific type of property map at compile time.
+        //
+        // TODO: It doesn't look like these are actually used anywhere. So
+        // it may be entirely possible to get rid of them. They don't actually
+        // contribute much to the code below...
+        enum property_map_id {
+            READABLE_PA,
+            WRITABLE_PA,
+            READ_WRITE_PA,
+            LVALUE_PA,
+            OP_BRACKET_PA,          // What's this?
+            RAND_ACCESS_ITER_PA,    // Random access?
+            LAST_PA
+        };
+    }
+
+    // Property tags. These tags are used to constrain and specialize put
+    // and get operations for property maps with different capabilities.
+    struct readable_property_map_tag { enum { id = detail::READABLE_PA }; };
+    struct writable_property_map_tag { enum { id = detail::WRITABLE_PA }; };
+    struct read_write_property_map_tag
+        : public readable_property_map_tag
+        , public writable_property_map_tag
+    { enum { id = detail::READ_WRITE_PA }; };
+    struct lvalue_property_map_tag
+        : public read_write_property_map_tag
+          { enum { id = detail::LVALUE_PA }; };
+
+
+    // Prebuilt specializations...
+
+#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+    // The user will just have to create their own specializations for
+    // other pointers types if the compiler does not have partial
+    // specializations. Sorry!
+#define BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(TYPE) \
+    template <> \
+    struct property_traits<TYPE*> { \
+    typedef TYPE value_type; \
+    typedef value_type& reference; \
+    typedef std::ptrdiff_t key_type; \
+    typedef lvalue_property_map_tag   category; \
+}; \
+    template <> \
+    struct property_traits<const TYPE*> { \
+    typedef TYPE value_type; \
+    typedef const value_type& reference; \
+    typedef std::ptrdiff_t key_type; \
+    typedef lvalue_property_map_tag   category; \
+}
+
+    // Automatically generate specializations for fundamental types.
+    BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(long);
+    BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned long);
+    BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(int);
+    BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned int);
+    BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(short);
+    BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned short);
+    BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(char);
+    BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned char);
+    BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(signed char);
+    BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(bool);
+    BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(float);
+    BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(double);
+    BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(long double);
+
+  // This may need to be turned off for some older compilers that don't have
+  // wchar_t intrinsically.
+# ifndef BOOST_NO_INTRINSIC_WCHAR_T
+    template <>
+    struct property_traits<wchar_t*>
+    {
+        typedef wchar_t value_type;
+        typedef value_type& reference;
+        typedef std::ptrdiff_t key_type;
+        typedef lvalue_property_map_tag   category;
+    };
+
+    template <>
+    struct property_traits<const wchar_t*>
+    {
+        typedef wchar_t value_type;
+        typedef const value_type& reference;
+        typedef std::ptrdiff_t key_type;
+        typedef lvalue_property_map_tag   category;
+    };
+# endif
+#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+    // Automatically specialize for all pointer types. This allows us to
+    // treat array types (ptrs) as property maps.
+    template <class T>
+    struct property_traits<T*>
+    {
+        typedef T value_type;
+        typedef value_type& reference;
+        typedef std::ptrdiff_t key_type;
+        typedef lvalue_property_map_tag category;
+    };
+
+    template <class T>
+    struct property_traits<const T*> {
+        typedef T value_type;
+        typedef const value_type& reference;
+        typedef std::ptrdiff_t key_type;
+        typedef lvalue_property_map_tag category;
+    };
+
+
+#endif
+} }
+
+// These variants of the put() and get() functions provide specializations for
+// pointer types. In this case, the "property map" is essentially an address,
+// the key is an offset from that address and the value, is... well, the value.
+// Note that the value type (V) must be convertible to the property map type (T).
+// Also, these need to go in global namespace because Koenig lookup does not
+// apply to T*.
+
+template <class T, class V>
+inline void put(T* pa, std::ptrdiff_t k, const V& val)
+{
+    pa[k] = val;
+}
+
+template <class T>
+inline const T& get(const T* pa, std::ptrdiff_t k)
+{
+    return pa[k];
+}
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+// Re-insert the put and get functions into to the property_map namespace.
+namespace boost { namespace property_map {
+    using ::put;
+    using ::get;
+} }
+#endif
+
+#endif
Added: sandbox/graph-v2/boost/property_map/reference_property_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/boost/property_map/reference_property_map.hpp	2007-09-04 13:40:54 EDT (Tue, 04 Sep 2007)
@@ -0,0 +1,55 @@
+// (C) Copyright Jeremy Siek 1999-2001.
+// (C) Andrew Sutton 2007
+//
+// 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)
+
+#ifndef BOOST_PROPERTY_MAP_REFERENCE_PROPERTY_MAP_HPP
+#define BOOST_PROPERTY_MAP_REFERENCE_PROPERTY_MAP_HPP
+
+#include <boost/property_map/property_traits.hpp>
+#include <boost/property_map/detail/put_get_helper.hpp>
+
+namespace boost { namespace property_map {
+
+    // The reference property map simply returns the same every time
+    // it is accessed. Note that put()ing the value will change the value
+    // that is returned for subsequent gets.
+
+    // NOTE: This class provides lvalue access via the operator[], but doesn't
+    // really need too.
+
+    template <typename Key, typename Value>
+    class reference_property_map
+    : public put_get_helper< Value&, reference_property_map<Key, Value> >
+    {
+    public:
+        typedef Key key_type;
+        typedef Value value_type;
+        typedef Value& reference;
+        typedef lvalue_property_map_tag category;
+
+        inline reference_property_map(value_type& v)
+            : value(v)
+        { }
+
+        inline reference operator[](const key_type &) const
+        { return value; }
+
+    private:
+        value_type& value;
+    };
+
+    // A generator function for creating reference property maps.
+    template <typename Key, typename Value>
+    inline reference_property_map<Key, Value>
+    make_reference_property_map(Value& v)
+    {
+        typedef reference_property_map<Key, Value> PropertyMap;
+        return PropertyMap(v);
+    }
+
+} }
+
+#endif