2
0
mirror of https://github.com/boostorg/graph.git synced 2026-02-01 08:32:11 +00:00

Keeping tag values around to allow bundled properties

[SVN r77633]
This commit is contained in:
Jeremiah Willcock
2012-03-29 18:42:53 +00:00
parent 5d1e1ce628
commit 428762da2b
2 changed files with 11 additions and 7 deletions

View File

@@ -325,10 +325,10 @@ namespace boost {
template <typename PropVal, typename PropertyTag>
void test_readable_vertex_property_graph
(const std::vector<PropVal>& vertex_prop, PropertyTag, const Graph& g)
(const std::vector<PropVal>& vertex_prop, PropertyTag tag, const Graph& g)
{
typedef typename property_map<Graph, PropertyTag>::const_type const_Map;
const_Map pmap = get(PropertyTag(), g);
const_Map pmap = get(tag, g);
typename std::vector<PropVal>::const_iterator i = vertex_prop.begin();
for (typename boost::graph_traits<Graph>::vertex_iterator
@@ -339,7 +339,7 @@ namespace boost {
++bgl_first_9) {
//BGL_FORALL_VERTICES_T(v, g, Graph) {
typename property_traits<const_Map>::value_type
pval1 = get(pmap, v), pval2 = get(PropertyTag(), g, v);
pval1 = get(pmap, v), pval2 = get(tag, g, v);
BOOST_CHECK(pval1 == pval2);
BOOST_CHECK(pval1 == *i++);
}
@@ -350,7 +350,7 @@ namespace boost {
(const std::vector<PropVal>& vertex_prop, PropertyTag tag, Graph& g)
{
typedef typename property_map<Graph, PropertyTag>::type PMap;
PMap pmap = get(PropertyTag(), g);
PMap pmap = get(tag, g);
typename std::vector<PropVal>::const_iterator i = vertex_prop.begin();
for (typename boost::graph_traits<Graph>::vertex_iterator
bgl_first_9 = vertices(g).first, bgl_last_9 = vertices(g).second;
@@ -368,7 +368,7 @@ namespace boost {
typename std::vector<PropVal>::const_iterator j = vertex_prop.begin();
BGL_FORALL_VERTICES_T(v, g, Graph)
put(PropertyTag(), g, v, *j++);
put(tag, g, v, *j++);
test_readable_vertex_property_graph(vertex_prop, tag, g);
}

View File

@@ -318,13 +318,15 @@ namespace boost {
class sgb_vertex_util_map
: public boost::put_get_helper<Ref, sgb_vertex_util_map<Tag, Ref> >
{
Tag tag;
public:
explicit sgb_vertex_util_map(Tag tag = Tag()): tag(tag) {}
typedef boost::lvalue_property_map_tag category;
typedef typename Tag::type value_type;
typedef Vertex* key_type;
typedef Ref reference;
reference operator[](Vertex* v) const {
return get_util_field(v, Tag());
return get_util_field(v, tag);
}
};
@@ -333,13 +335,15 @@ namespace boost {
class sgb_edge_util_map
: public boost::put_get_helper<Ref, sgb_edge_util_map<Tag, Ref> >
{
Tag tag;
public:
explicit sgb_edge_util_map(Tag tag = Tag()): tag(tag) {}
typedef boost::lvalue_property_map_tag category;
typedef typename Tag::type value_type;
typedef Vertex* key_type;
typedef Ref reference;
reference operator[](const sgb_edge& e) const {
return get_util_field(e._arc, Tag());
return get_util_field(e._arc, tag);
}
};