Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53221 - in trunk/boost/graph: . distributed
From: jewillco_at_[hidden]
Date: 2009-05-23 19:30:32


Author: jewillco
Date: 2009-05-23 19:30:31 EDT (Sat, 23 May 2009)
New Revision: 53221
URL: http://svn.boost.org/trac/boost/changeset/53221

Log:
Changed to standard Boost reference_wrapper rather than wrap_ref
Text files modified:
   trunk/boost/graph/breadth_first_search.hpp | 6 ++----
   trunk/boost/graph/distributed/betweenness_centrality.hpp | 19 ++++++++++---------
   trunk/boost/graph/named_function_params.hpp | 21 +++++++--------------
   trunk/boost/graph/neighbor_bfs.hpp | 7 +++----
   4 files changed, 22 insertions(+), 31 deletions(-)

Modified: trunk/boost/graph/breadth_first_search.hpp
==============================================================================
--- trunk/boost/graph/breadth_first_search.hpp (original)
+++ trunk/boost/graph/breadth_first_search.hpp 2009-05-23 19:30:31 EDT (Sat, 23 May 2009)
@@ -227,10 +227,9 @@
       typedef typename Traits::vertex_descriptor Vertex;
       typedef boost::queue<Vertex> queue_t;
       queue_t Q;
- detail::wrap_ref<queue_t> Qref(Q);
       breadth_first_search
         (g, s,
- choose_param(get_param(params, buffer_param_t()), Qref).ref,
+ choose_param(get_param(params, buffer_param_t()), boost::ref(Q)).get(),
          vis, color);
     }
 
@@ -333,11 +332,10 @@
     typedef typename Traits::vertex_descriptor vertex_descriptor;
     typedef boost::queue<vertex_descriptor> queue_t;
     queue_t Q;
- detail::wrap_ref<queue_t> Qref(Q);
 
     breadth_first_visit
       (ng, s,
- choose_param(get_param(params, buffer_param_t()), Qref).ref,
+ choose_param(get_param(params, buffer_param_t()), boost::ref(Q)).get(),
        choose_param(get_param(params, graph_visitor),
                     make_bfs_visitor(null_visitor())),
        choose_pmap(get_param(params, vertex_color), ng, vertex_color)

Modified: trunk/boost/graph/distributed/betweenness_centrality.hpp
==============================================================================
--- trunk/boost/graph/distributed/betweenness_centrality.hpp (original)
+++ trunk/boost/graph/distributed/betweenness_centrality.hpp 2009-05-23 19:30:31 EDT (Sat, 23 May 2009)
@@ -20,6 +20,7 @@
 #include <boost/graph/distributed/concepts.hpp>
 #include <boost/graph/graph_traits.hpp>
 #include <boost/config.hpp>
+#include <boost/ref.hpp>
 
 // For additive_reducer
 #include <boost/graph/distributed/distributed_graph_utility.hpp>
@@ -1307,7 +1308,7 @@
       make_iterator_property_map(distance.begin(), vertex_index),
       make_iterator_property_map(dependency.begin(), vertex_index),
       make_iterator_property_map(path_count.begin(), vertex_index),
- vertex_index, sources.ref, delta,
+ vertex_index, sources, delta,
       weight_map);
   }
   
@@ -1344,7 +1345,7 @@
       make_iterator_property_map(distance.begin(), vertex_index),
       make_iterator_property_map(dependency.begin(), vertex_index),
       make_iterator_property_map(path_count.begin(), vertex_index),
- vertex_index, sources.ref, delta);
+ vertex_index, sources, delta);
   }
 
   template<typename WeightMap>
@@ -1400,7 +1401,7 @@
                  dummy_property_map()),
     choose_const_pmap(get_param(params, vertex_index), g, vertex_index),
     choose_param(get_param(params, buffer_param_t()),
- detail::wrap_ref<queue_t>(q)),
+ boost::ref(q)),
     choose_param(get_param(params, lookahead_t()), 0),
     get_param(params, edge_weight));
 }
@@ -1414,7 +1415,7 @@
   queue_t q;
 
   boost::graph::parallel::detail::brandes_betweenness_centrality_dispatch2(
- g, centrality, dummy_property_map(), get(vertex_index, g), detail::wrap_ref<queue_t>(q), 0);
+ g, centrality, dummy_property_map(), get(vertex_index, g), boost::ref(q), 0);
 }
 
 template<typename Graph, typename CentralityMap, typename EdgeCentralityMap>
@@ -1427,7 +1428,7 @@
   queue_t q;
 
   boost::graph::parallel::detail::brandes_betweenness_centrality_dispatch2(
- g, centrality, edge_centrality_map, get(vertex_index, g), detail::wrap_ref<queue_t>(q), 0);
+ g, centrality, edge_centrality_map, get(vertex_index, g), boost::ref(q), 0);
 }
   
 template<typename ProcessGroup, typename Graph, typename CentralityMap,
@@ -1524,7 +1525,7 @@
       make_iterator_property_map(distance.begin(), vertex_index),
       make_iterator_property_map(dependency.begin(), vertex_index),
       make_iterator_property_map(path_count.begin(), vertex_index),
- vertex_index, weight_map, sources.ref);
+ vertex_index, weight_map, sources);
   }
   
 
@@ -1561,7 +1562,7 @@
       make_iterator_property_map(distance.begin(), vertex_index),
       make_iterator_property_map(dependency.begin(), vertex_index),
       make_iterator_property_map(path_count.begin(), vertex_index),
- vertex_index, sources.ref);
+ vertex_index, sources);
   }
 
   template<typename WeightMap>
@@ -1615,7 +1616,7 @@
                  dummy_property_map()),
     choose_const_pmap(get_param(params, vertex_index), g, vertex_index),
     choose_param(get_param(params, buffer_param_t()),
- detail::wrap_ref<queue_t>(q)),
+ boost::ref(q)),
     get_param(params, edge_weight));
 }
 
@@ -1629,7 +1630,7 @@
 
   detail::graph::non_distributed_brandes_betweenness_centrality_dispatch2(
     pg, g, centrality, dummy_property_map(), get(vertex_index, g),
- detail::wrap_ref<queue_t>(q));
+ boost::ref(q));
 }
 
 template<typename ProcessGroup, typename Graph, typename CentralityMap,

Modified: trunk/boost/graph/named_function_params.hpp
==============================================================================
--- trunk/boost/graph/named_function_params.hpp (original)
+++ trunk/boost/graph/named_function_params.hpp 2009-05-23 19:30:31 EDT (Sat, 23 May 2009)
@@ -11,6 +11,7 @@
 #define BOOST_GRAPH_NAMED_FUNCTION_PARAMS_HPP
 
 #include <boost/graph/properties.hpp>
+#include <boost/ref.hpp>
 
 namespace boost {
 
@@ -41,14 +42,6 @@
   struct diameter_range_t { };
   struct learning_constant_range_t { };
 
- namespace detail {
- template <class T>
- struct wrap_ref {
- wrap_ref(T& r) : ref(r) {}
- T& ref;
- };
- }
-
   template <typename T, typename Tag, typename Base = no_property>
   struct bgl_named_params : public Base
   {
@@ -245,11 +238,11 @@
     }
 
     template <typename Buffer>
- bgl_named_params<detail::wrap_ref<Buffer>, buffer_param_t, self>
+ bgl_named_params<boost::reference_wrapper<Buffer>, buffer_param_t, self>
     buffer(Buffer& b) const {
- typedef bgl_named_params<detail::wrap_ref<Buffer>, buffer_param_t, self>
+ typedef bgl_named_params<boost::reference_wrapper<Buffer>, buffer_param_t, self>
         Params;
- return Params(detail::wrap_ref<Buffer>(b), *this);
+ return Params(boost::ref(b), *this);
     }
 
     template <typename Copier>
@@ -547,10 +540,10 @@
   }
 
   template <typename Buffer>
- bgl_named_params<detail::wrap_ref<Buffer>, buffer_param_t>
+ bgl_named_params<boost::reference_wrapper<Buffer>, buffer_param_t>
   buffer(Buffer& b) {
- typedef bgl_named_params<detail::wrap_ref<Buffer>, buffer_param_t> Params;
- return Params(detail::wrap_ref<Buffer>(b));
+ typedef bgl_named_params<boost::reference_wrapper<Buffer>, buffer_param_t> Params;
+ return Params(boost::ref(b));
   }
 
   template <typename Copier>

Modified: trunk/boost/graph/neighbor_bfs.hpp
==============================================================================
--- trunk/boost/graph/neighbor_bfs.hpp (original)
+++ trunk/boost/graph/neighbor_bfs.hpp 2009-05-23 19:30:31 EDT (Sat, 23 May 2009)
@@ -17,6 +17,7 @@
   (for directed graphs only. use normal BFS for undirected graphs)
 */
 #include <boost/config.hpp>
+#include <boost/ref.hpp>
 #include <vector>
 #include <boost/pending/queue.hpp>
 #include <boost/graph/graph_traits.hpp>
@@ -211,7 +212,6 @@
       typedef typename Traits::vertex_descriptor Vertex;
       typedef boost::queue<Vertex> queue_t;
       queue_t Q;
- detail::wrap_ref<queue_t> Qref(Q);
       // Initialization
       typedef typename property_traits<ColorMap>::value_type ColorValue;
       typedef color_traits<ColorValue> Color;
@@ -222,7 +222,7 @@
       }
       neighbor_bfs_impl
         (g, s,
- choose_param(get_param(params, buffer_param_t()), Qref).ref,
+ choose_param(get_param(params, buffer_param_t()), boost::ref(Q)).get(),
          vis, color);
     }
 
@@ -306,11 +306,10 @@
     // Buffer default
     typedef boost::queue<typename Traits::vertex_descriptor> queue_t;
     queue_t Q;
- detail::wrap_ref<queue_t> Qref(Q);
 
     detail::neighbor_bfs_impl
       (g, s,
- choose_param(get_param(params, buffer_param_t()), Qref).ref,
+ choose_param(get_param(params, buffer_param_t()), boost::ref(Q)).get(),
        choose_param(get_param(params, graph_visitor),
                     make_neighbor_bfs_visitor(null_visitor())),
        choose_pmap(get_param(params, vertex_color), g, vertex_color)


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