Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77633 - trunk/boost/graph
From: jewillco_at_[hidden]
Date: 2012-03-29 14:42:54


Author: jewillco
Date: 2012-03-29 14:42:53 EDT (Thu, 29 Mar 2012)
New Revision: 77633
URL: http://svn.boost.org/trac/boost/changeset/77633

Log:
Keeping tag values around to allow bundled properties
Text files modified:
   trunk/boost/graph/graph_test.hpp | 10 +++++-----
   trunk/boost/graph/stanford_graph.hpp | 8 ++++++--
   2 files changed, 11 insertions(+), 7 deletions(-)

Modified: trunk/boost/graph/graph_test.hpp
==============================================================================
--- trunk/boost/graph/graph_test.hpp (original)
+++ trunk/boost/graph/graph_test.hpp 2012-03-29 14:42:53 EDT (Thu, 29 Mar 2012)
@@ -325,10 +325,10 @@
 
     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 @@
          ++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 @@
       (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 @@
       
       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);
     }

Modified: trunk/boost/graph/stanford_graph.hpp
==============================================================================
--- trunk/boost/graph/stanford_graph.hpp (original)
+++ trunk/boost/graph/stanford_graph.hpp 2012-03-29 14:42:53 EDT (Thu, 29 Mar 2012)
@@ -318,13 +318,15 @@
   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 @@
   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);
     }
   };
 


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