Boost logo

Boost Users :

Subject: [Boost-users] [Graph] call of overloaded 'target(...)' is ambiguous
From: Tim Keitt (tkeitt_at_[hidden])
Date: 2008-12-04 17:11:08


I've hit the wall with the Graph library. I cannot seem to resolve the
error shown below. This is probably my rather limited experience with
complicated template parameters. What is the first thing to try with
these sorts of errors? My graph classes do not define source and
target, but rely on the template provided in the Graph library. I've
tried adding them explicitly to the class without success.

The 'target' template is defined as:

  template <typename G>
  typename filtered_graph_base<G>::vertex_descriptor
  target(typename filtered_graph_base<G>::edge_descriptor e,
         const filtered_graph_base<G>& g)
  {
    return target(e, g.m_g);
  }

The ambiguous call to 'target' occurs here:

  template <class PredEdgeMap, class Tag>
  struct edge_predecessor_recorder
    : public base_visitor<edge_predecessor_recorder<PredEdgeMap, Tag> >
  {
    typedef Tag event_filter;
    edge_predecessor_recorder(PredEdgeMap pa) : m_predecessor(pa) { }
    template <class Edge, class Graph>
    void operator()(Edge e, const Graph& g) {
      put(m_predecessor, target(e, g), e);
    }
    PredEdgeMap m_predecessor;
  };

Notice that the 'target' template takes one parameter ('G') and the
'operator()' template takes two parameters ('Edge' and 'Graph').
Notice also below the occurrence of both 'G' and 'Graph' in the
'candidates are' section.

Might this be fixed as:

    template <class Graph>
    void operator()(typename Graph::edge_descriptor e, const Graph& g) {
      put(m_predecessor, target(e, g), e);
    }

???

THK

/usr/include/boost/graph/edmunds_karp_max_flow.hpp:232: instantiated
from 'typename boost::detail::edge_capacity_value<Graph, P, T,
R>::type boost::edmunds_karp_max_flow(Graph&, typename
boost::graph_traits<G>::vertex_descriptor, typename
boost::graph_traits<G>::vertex_descriptor, const
boost::bgl_named_params<P, T, R>&) [with Graph =
FlowCapacitySQLDiGraph, P =
edge_index_property_map<FlowCapacitySQLDiGraph, double>, T =
boost::edge_residual_capacity_t, R = boost::no_property]'
postgraph.cpp:1092: instantiated from here
/usr/include/boost/graph/visitors.hpp:176: error: call of overloaded
'target(FlowCapacitySQLDiGraph::edge_descriptor&, const
boost::filtered_graph<FlowCapacitySQLDiGraph,
boost::is_residual_edge<edge_index_property_map<FlowCapacitySQLDiGraph,
double> >, boost::keep_all>&)' is ambiguous
/usr/include/boost/graph/filtered_graph.hpp:322: note: candidates are:
typename boost::filtered_graph_base<G>::vertex_descriptor
boost::target(typename boost::filtered_graph_base<G>::edge_descriptor,
const boost::filtered_graph_base<Graph>&) [with G =
FlowCapacitySQLDiGraph]
/usr/include/boost/graph/graph_traits.hpp:154: note: T
std::target(std::pair<_ForwardIterator, _ForwardIterator>, const G&)
[with T = unsigned int, G =
boost::filtered_graph<FlowCapacitySQLDiGraph,
boost::is_residual_edge<edge_index_property_map<FlowCapacitySQLDiGraph,
double> >, boost::keep_all>]
make: *** [postgraph.o] Error 1

-- 
Timothy H. Keitt
http://www.keittlab.org/

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net