[Graph] call of overloaded 'target(...)' is ambiguous

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 &) [with Graph =
FlowCapacitySQLDiGraph, P =
edge_index_property_map

Hi Tim, You might try to use boost::target() instead of target() Regards, Dmitry Tim Keitt wrote:
The ambiguous call to 'target' occurs here:
template
struct edge_predecessor_recorder : public base_visitor > { typedef Tag event_filter; edge_predecessor_recorder(PredEdgeMap pa) : m_predecessor(pa) { } template 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); }
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,
/usr/include/boost/graph/graph_traits.hpp:154: note: T std::target(std::pair<_ForwardIterator, _ForwardIterator>, const G&)

/usr/include/boost/graph/edmunds_karp_max_flow.hpp:232: instantiated from 'typename boost::detail::edge_capacity_value
::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 &) [with Graph = FlowCapacitySQLDiGraph, P = edge_index_property_map
, 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 >, 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 >, boost::keep_all>] make: *** [postgraph.o] Error 1
I'm not sure what version of GCC you're using - I assume it's GCC - but you're ambiguity is coming from the fact that you probably have "using namespace std" somewhere above this point in your code. The file boost/graph/graph_traits.hpp puts a source() and target() function into the standard namespace to provide an overload for a pair of vertex descriptors, which is apparently need for some kinds of edge descriptor. Using graph_traits<G>::edge_descriptor as the parameter type might work. Explicitly calling boost::traget() will also probably work. Andrew Sutton andrew.n.sutton@gmail.com
participants (3)
-
Andrew Sutton
-
Dmitry Bufistov
-
Tim Keitt