|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53174 - in trunk: boost/graph libs/graph/test
From: asutton_at_[hidden]
Date: 2009-05-22 08:50:09
Author: asutton
Date: 2009-05-22 08:50:07 EDT (Fri, 22 May 2009)
New Revision: 53174
URL: http://svn.boost.org/trac/boost/changeset/53174
Log:
Added overloads to subgraph to work with const bundled property map.
Text files modified:
trunk/boost/graph/directed_graph.hpp | 7 +----
trunk/boost/graph/subgraph.hpp | 43 ++++++++++++++++++++++++---------------
trunk/libs/graph/test/test_graph.hpp | 2 -
trunk/libs/graph/test/test_graphs.cpp | 4 ++
4 files changed, 31 insertions(+), 25 deletions(-)
Modified: trunk/boost/graph/directed_graph.hpp
==============================================================================
--- trunk/boost/graph/directed_graph.hpp (original)
+++ trunk/boost/graph/directed_graph.hpp 2009-05-22 08:50:07 EDT (Fri, 22 May 2009)
@@ -588,8 +588,7 @@
template <DIRECTED_GRAPH_PARAMS, typename Type, typename Bundle>
inline typename property_map<DIRECTED_GRAPH, Type Bundle::*>::type
-get(Type Bundle::* p, DIRECTED_GRAPH& g)
-{
+get(Type Bundle::* p, DIRECTED_GRAPH& g) {
typedef typename property_map<
DIRECTED_GRAPH, Type Bundle::*
>::type return_type;
@@ -598,8 +597,7 @@
template <DIRECTED_GRAPH_PARAMS, typename Type, typename Bundle>
inline typename property_map<DIRECTED_GRAPH, Type Bundle::*>::const_type
-get(Type Bundle::* p, DIRECTED_GRAPH const& g)
-{
+get(Type Bundle::* p, DIRECTED_GRAPH const& g) {
typedef typename property_map<
DIRECTED_GRAPH, Type Bundle::*
>::const_type return_type;
@@ -613,7 +611,6 @@
template <DIRECTED_GRAPH_PARAMS, typename Type, typename Bundle, typename Key, typename Value>
inline void put(Type Bundle::* p, DIRECTED_GRAPH& g, Key const& k, Value const& v)
{ put(p, g.impl(), k, v); }
-
#endif
// Vertex index management
Modified: trunk/boost/graph/subgraph.hpp
==============================================================================
--- trunk/boost/graph/subgraph.hpp (original)
+++ trunk/boost/graph/subgraph.hpp 2009-05-22 08:50:07 EDT (Fri, 22 May 2009)
@@ -841,37 +841,46 @@
}
#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES
- template<typename TG, typename T, typename Bundle>
- inline
- typename property_map<subgraph<TG>, T Bundle::*>::type
- get(T Bundle::* p, subgraph<TG>& sg)
- {
- typedef typename property_map<subgraph<TG>, T Bundle::*>::type
- result_type;
- return result_type(&sg, p);
- }
-
+ template<typename G, typename T, typename Bundle>
+ inline typename property_map<subgraph<G>, T Bundle::*>::type
+ get(T Bundle::* p, subgraph<G>& g) {
+ typedef typename property_map<subgraph<G>, T Bundle::*>::type Map;
+ return Map(&g, p);
+ }
+
+ template<typename G, typename T, typename Bundle>
+ inline typename property_map<subgraph<G>, T Bundle::*>::const_type
+ get(T Bundle::* p, subgraph<G> const& g) {
+ typedef typename property_map<subgraph<G>, T Bundle::*>::const_type Map;
+ return Map(&g, p);
+ }
+
+ template <typename Graph, typename Type, typename Bundle, typename Key>
+ inline Type get(Type Bundle::* p, subgraph<Graph> const& g, Key const& k)
+ { return get(get(p, g), k); }
+
+ template <
+ typename Graph, typename Type, typename Bundle, typename Key,
+ typename Value>
+ inline void put(Type Bundle::* p, Graph& g, Key const& k, Value const& v)
+ { put(get(p, g), k, v); }
#endif
template <typename G, typename Property, typename Key, typename Value>
- void
- put(Property, subgraph<G>& g, const Key& k, const Value& val)
- {
+ void put(Property, subgraph<G>& g, const Key& k, const Value& val) {
typedef typename property_map< subgraph<G>, Property>::type PMap;
PMap pmap(&g);
pmap[k] = val;
}
template <typename G, typename Tag>
- inline
- typename graph_property<G, Tag>::type&
+ inline typename graph_property<G, Tag>::type&
get_property(subgraph<G>& g, Tag tag) {
return get_property(g.m_graph, tag);
}
template <typename G, typename Tag>
- inline
- const typename graph_property<G, Tag>::type&
+ inline const typename graph_property<G, Tag>::type&
get_property(const subgraph<G>& g, Tag tag) {
return get_property(g.m_graph, tag);
}
Modified: trunk/libs/graph/test/test_graph.hpp
==============================================================================
--- trunk/libs/graph/test/test_graph.hpp (original)
+++ trunk/libs/graph/test/test_graph.hpp 2009-05-22 08:50:07 EDT (Fri, 22 May 2009)
@@ -22,8 +22,6 @@
#include <boost/graph/graph_mutability_traits.hpp>
#include <boost/graph/graph_concepts.hpp>
-#include "typestr.hpp"
-
#define BOOST_META_ASSERT(x) BOOST_ASSERT(x::value)
typedef std::pair<std::size_t, std::size_t> Pair;
Modified: trunk/libs/graph/test/test_graphs.cpp
==============================================================================
--- trunk/libs/graph/test/test_graphs.cpp (original)
+++ trunk/libs/graph/test/test_graphs.cpp 2009-05-22 08:50:07 EDT (Fri, 22 May 2009)
@@ -8,6 +8,8 @@
#define BOOST_NO_HASH
+#include "typestr.hpp"
+
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/adjacency_matrix.hpp>
#include <boost/graph/undirected_graph.hpp>
@@ -154,7 +156,7 @@
typedef adjacency_list<vecS, vecS, directedS, VertexBundle, EdgeProp> BaseGraph;
typedef subgraph<BaseGraph> Graph;
Graph g;
-// test_graph(g);
+ test_graph(g);
}
}
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