Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / graph / reverse_graph.hpp
index 96fc32d..24eb1c7 100644 (file)
 #include <boost/type_traits.hpp>
 #include <boost/mpl/if.hpp>
 
-#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
-// Stay out of the way of the concept checking class
-# define BidirectionalGraph BidirectionalGraph_
-#endif
-
 namespace boost {
 
 struct reverse_graph_tag { };
@@ -109,6 +104,8 @@ class reverse_graph {
 
     // Constructor
     reverse_graph(GraphRef g) : m_g(g) {}
+    // Conversion from reverse_graph on non-const reference to one on const reference
+    reverse_graph(const reverse_graph<BidirectionalGraph, BidirectionalGraph&>& o): m_g(o.m_g) {}
 
     // Graph requirements
     typedef typename Traits::vertex_descriptor vertex_descriptor;
@@ -364,7 +361,12 @@ namespace detail {
 template <class BidirGraph, class GRef, class Property>
 struct property_map<reverse_graph<BidirGraph, GRef>, Property> {
   typedef boost::is_same<typename detail::property_kind_from_graph<BidirGraph, Property>::type, edge_property_tag> is_edge_prop;
-  typedef typename property_map<BidirGraph, Property>::type orig_type;
+  typedef boost::is_const<typename boost::remove_reference<GRef>::type> is_ref_const;
+  typedef typename boost::mpl::if_<
+                     is_ref_const,
+                     typename property_map<BidirGraph, Property>::const_type,
+                     typename property_map<BidirGraph, Property>::type>::type
+    orig_type;
   typedef typename property_map<BidirGraph, Property>::const_type orig_const_type;
   typedef typename boost::mpl::if_<is_edge_prop, detail::reverse_graph_edge_property_map<orig_type>, orig_type>::type type;
   typedef typename boost::mpl::if_<is_edge_prop, detail::reverse_graph_edge_property_map<orig_const_type>, orig_const_type>::type const_type;
@@ -433,7 +435,7 @@ namespace detail {
   {
     return m[k];
   }
-};
+}
 
 template <class E>
 struct property_traits<detail::underlying_edge_desc_map_type<E> > {
@@ -460,7 +462,7 @@ 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,
-    G& g)
+    G&)
 {
   return detail::underlying_edge_desc_map_type<typename graph_traits<typename G::base_type>::edge_descriptor>();
 }
@@ -468,7 +470,7 @@ get(edge_underlying_t,
 template <class G>
 typename enable_if<is_reverse_graph<G>, typename graph_traits<typename G::base_type>::edge_descriptor>::type
 get(edge_underlying_t,
-    G& g,
+    G&,
     const typename graph_traits<G>::edge_descriptor& k)
 {
   return k.underlying_descx;
@@ -477,7 +479,7 @@ get(edge_underlying_t,
 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 G& g)
+    const G&)
 {
   return detail::underlying_edge_desc_map_type<typename graph_traits<typename G::base_type>::edge_descriptor>();
 }
@@ -485,7 +487,7 @@ get(edge_underlying_t,
 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 G& g,
+    const G&,
     const typename graph_traits<G>::edge_descriptor& k)
 {
   return k.underlying_descx;