Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78315 - trunk/boost/graph
From: jewillco_at_[hidden]
Date: 2012-05-03 12:20:59


Author: jewillco
Date: 2012-05-03 12:20:58 EDT (Thu, 03 May 2012)
New Revision: 78315
URL: http://svn.boost.org/trac/boost/changeset/78315

Log:
Edited reverse_graph to fix test case; fixes #6858
Text files modified:
   trunk/boost/graph/reverse_graph.hpp | 37 +++++++++++++++++++++----------------
   1 files changed, 21 insertions(+), 16 deletions(-)

Modified: trunk/boost/graph/reverse_graph.hpp
==============================================================================
--- trunk/boost/graph/reverse_graph.hpp (original)
+++ trunk/boost/graph/reverse_graph.hpp 2012-05-03 12:20:58 EDT (Thu, 03 May 2012)
@@ -105,6 +105,7 @@
     typedef graph_traits<BidirectionalGraph> Traits;
  public:
     typedef BidirectionalGraph base_type;
+ typedef GraphRef base_ref_type;
 
     // Constructor
     reverse_graph(GraphRef g) : m_g(g) {}
@@ -446,36 +447,40 @@
   typedef detail::underlying_edge_desc_map_type<ed> const_type;
 };
 
-template <class Graph, class GRef>
-detail::underlying_edge_desc_map_type<typename graph_traits<Graph>::edge_descriptor>
+template <typename T> struct is_reverse_graph: boost::mpl::false_ {};
+template <typename G, typename R> struct is_reverse_graph<reverse_graph<G, R> >: boost::mpl::true_ {};
+
+template <class G>
+typename enable_if<is_reverse_graph<G>,
+ detail::underlying_edge_desc_map_type<typename graph_traits<typename G::base_type>::edge_descriptor> >::type
 get(edge_underlying_t,
- reverse_graph<Graph,GRef>& g)
+ G& g)
 {
- return detail::underlying_edge_desc_map_type<typename graph_traits<Graph>::edge_descriptor>();
+ return detail::underlying_edge_desc_map_type<typename graph_traits<typename G::base_type>::edge_descriptor>();
 }
 
-template <class Graph, class GRef>
-typename graph_traits<Graph>::edge_descriptor
+template <class G>
+typename enable_if<is_reverse_graph<G>, typename graph_traits<typename G::base_type>::edge_descriptor>::type
 get(edge_underlying_t,
- reverse_graph<Graph,GRef>& g,
- const typename graph_traits<reverse_graph<Graph, GRef> >::edge_descriptor& k)
+ G& g,
+ const typename graph_traits<G>::edge_descriptor& k)
 {
   return k.underlying_descx;
 }
 
-template <class Graph, class GRef>
-detail::underlying_edge_desc_map_type<typename graph_traits<Graph>::edge_descriptor>
+template <class G>
+typename enable_if<is_reverse_graph<G>, detail::underlying_edge_desc_map_type<typename graph_traits<typename G::base_type>::edge_descriptor> >::type
 get(edge_underlying_t,
- const reverse_graph<Graph,GRef>& g)
+ const G& g)
 {
- return detail::underlying_edge_desc_map_type<typename graph_traits<Graph>::edge_descriptor>();
+ return detail::underlying_edge_desc_map_type<typename graph_traits<typename G::base_type>::edge_descriptor>();
 }
 
-template <class Graph, class GRef>
-typename graph_traits<Graph>::edge_descriptor
+template <class G>
+typename enable_if<is_reverse_graph<G>, typename graph_traits<typename G::base_type>::edge_descriptor>::type
 get(edge_underlying_t,
- const reverse_graph<Graph,GRef>& g,
- const typename graph_traits<reverse_graph<Graph, GRef> >::edge_descriptor& k)
+ const G& g,
+ const typename graph_traits<G>::edge_descriptor& k)
 {
   return k.underlying_descx;
 }


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