to Boost Graph Library designers:
in the boost/graph/graph_traits.hpp (line 104):
//--begin----------------------------------------------------------------
// Since pair is in namespace std, Koenig lookup will find source and
// target if they are also defined in namespace std. This is illegal,
// but the alternative is to put source and target in the global
// namespace which causes name conflicts with other libraries (like
// SUIF).
namespace std {
template
T source(pair p, const G&) { return p.first; }
template
T target(pair p, const G&) { return p.second; }
}
//--end----------------------------------------------------------------
why not change it with:
//--begin----------------------------------------------------------------
template
typename boost::graph_traits<G>::vertex_descriptor
source(E e, const G& g) { return boost::source(e,g); }
template
typename boost::graph_traits<G>::vertex_descriptor
target(E e, const G& g) { return boost::target(e,g); }
//--end----------------------------------------------------------------
and add the following in boost/graph/vector_as_graph.hpp
//--begin----------------------------------------------------------------
template
T source(std::pair p, const std::vector&) { return
p.first; }
template
T target(std::pair p, const std::vector&) { return
p.second; }
//---end---------------------------------------------------------------
which means, vector_as_graph handles source() and target() inside its class
(and in boost namespace)
and makes std::source() and std::target() more general
the reason why I want to modify this is that
the original design makes trouble when I try to develop a subgraph view
adaptor (something like filtered_graph, but accept vector_as_graph type)
I need to define my own source() and target() to deal with my own subgraph
view class, as shown below:
namespace boost {
template <class G>
typename subview_graph<G>::vertex_descriptor
target(typename subview_graph<G>::edge_descriptor e, subview_graph<G>&
v)
{...}
}
however, when dealing with vector_as_graph (which means the 1st argument,
edge_descriptor, will be std::pair),
the compiler complains ambiguity between std::target() and boost::target()
in fact, it will make trouble to everyone who wants to define his/her own
source() & target() function but the 1st argument is std::pair
if it's possible, please fix this strange design
or any other opinions will be appreciated
best regards,
hcyeh