Ticket #6391: reverse_graph_desc.patch

File reverse_graph_desc.patch, 1.7 KB (added by tiago@…, 11 years ago)

Proposed patch

  • .hpp

    old new struct reverse_graph_tag { };  
    2525  namespace detail {
    2626
    2727    template <typename EdgeDesc>
    28     class reverse_graph_edge_descriptor {
    29       public:
    30       EdgeDesc underlying_desc;
    31 
     28    class reverse_graph_edge_descriptor: public EdgeDesc {
    3229      public:
     30      typedef EdgeDesc base_t;
    3331      explicit reverse_graph_edge_descriptor(const EdgeDesc& underlying_desc = EdgeDesc())
    34         : underlying_desc(underlying_desc) {}
    35 
    36       friend bool operator==(const reverse_graph_edge_descriptor& a, const reverse_graph_edge_descriptor& b) {
    37         return a.underlying_desc == b.underlying_desc;
    38       }
    39       friend bool operator!=(const reverse_graph_edge_descriptor& a, const reverse_graph_edge_descriptor& b) {
    40         return a.underlying_desc != b.underlying_desc;
    41       }
     32          : base_t(underlying_desc) {}
    4233    };
    4334
    4435    template <typename EdgeDesc>
    template <class Edge, class Bidirectiona  
    280271inline typename graph_traits<BidirectionalGraph>::vertex_descriptor
    281272source(const detail::reverse_graph_edge_descriptor<Edge>& e, const reverse_graph<BidirectionalGraph,GRef>& g)
    282273{
    283     return target(e.underlying_desc, g.m_g);
     274    return target(Edge(e), g.m_g);
    284275}
    285276
    286277template <class Edge, class BidirectionalGraph, class GRef>
    287278inline typename graph_traits<BidirectionalGraph>::vertex_descriptor
    288279target(const detail::reverse_graph_edge_descriptor<Edge>& e, const reverse_graph<BidirectionalGraph,GRef>& g)
    289280{
    290     return source(e.underlying_desc, g.m_g);
     281    return source(Edge(e), g.m_g);
    291282}
    292283
    293284