#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 { };
// 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;
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;
{
return m[k];
}
-};
+}
template <class E>
struct property_traits<detail::underlying_edge_desc_map_type<E> > {
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>();
}
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;
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>();
}
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;