|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52909 - trunk/boost/graph
From: asutton_at_[hidden]
Date: 2009-05-11 13:37:17
Author: asutton
Date: 2009-05-11 13:37:16 EDT (Mon, 11 May 2009)
New Revision: 52909
URL: http://svn.boost.org/trac/boost/changeset/52909
Log:
Abstracted a set of metafunctions that can be used to deduce vertex
and edge property types for graph adaptors.
Text files modified:
trunk/boost/graph/properties.hpp | 50 +++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 1 deletions(-)
Modified: trunk/boost/graph/properties.hpp
==============================================================================
--- trunk/boost/graph/properties.hpp (original)
+++ trunk/boost/graph/properties.hpp 2009-05-11 13:37:16 EDT (Mon, 11 May 2009)
@@ -6,13 +6,19 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================
+
#ifndef BOOST_GRAPH_PROPERTIES_HPP
#define BOOST_GRAPH_PROPERTIES_HPP
#include <boost/config.hpp>
#include <cassert>
#include <boost/pending/property.hpp>
+
+// Include the property map library and extensions in the BGL.
#include <boost/property_map/property_map.hpp>
+#include <boost/graph/property_maps/constant_property_map.hpp>
+#include <boost/graph/property_maps/null_property_map.hpp>
+
#include <boost/graph/graph_traits.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/limits.hpp>
@@ -394,13 +400,55 @@
vertex_bundled,
edge_bundled>::type
actual_bundle;
-
+
public:
typedef bundle_property_map<Graph, descriptor, actual_bundle, T> type;
typedef bundle_property_map<const Graph, descriptor, actual_bundle, const T>
const_type;
};
#endif
+
+// These metafunctions help implement the process of determining the vertex
+// and edge properties of a graph.
+namespace graph_detail {
+ template <typename Retag>
+ struct retagged_property {
+ typedef typename Retag::type type;
+ };
+
+ template <typename Retag, typename With, typename Without>
+ struct retagged_bundle {
+ typedef typename mpl::if_<
+ is_same<typename Retag::retagged, no_property>,
+ Without,
+ With
+ >::type type;
+ };
+
+ template <typename Prop>
+ struct vertex_prop {
+ private:
+ typedef detail::retag_property_list<vertex_bundle_t, Prop> Retag;
+ public:
+ typedef typename retagged_property<Retag>::type type;
+ typedef typename retagged_bundle<
+ Retag, Prop, no_vertex_bundle
+ >::type bundle;
+ };
+
+ template <typename Prop>
+ struct edge_prop {
+// private:
+ typedef detail::retag_property_list<edge_bundle_t, Prop> Retag;
+ public:
+ typedef typename Retag::retagged retagged;
+ typedef typename retagged_property<Retag>::type type;
+ typedef typename retagged_bundle<
+ Retag, Prop, no_edge_bundle
+ >::type bundle;
+ };
+} // namespace graph_detail
+
} // namespace boost
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
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