$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [BGL] Multithread problem inserting edges and exploring the same graph
From: Cosimo Calabrese (cosimo.calabrese_at_[hidden])
Date: 2009-09-18 08:47:10
> Now I'm trying to implement the EdgeMutableGraph concept, in order to 
> obtain the add_edge() support, but I've a problem.
> 
> template <typename G>
> std::pair<typename sync_adjacency_list<G>::edge_descriptor, bool>
> add_edge(const typename sync_adjacency_list<G>::vertex_descriptor u,
>          const typename sync_adjacency_list<G>::vertex_descriptor v,
>          const sync_adjacency_list<G>& g)
> {
>   interprocess::scoped_lock<interprocess::interprocess_mutex>
>   lock( sync_adjacency_list_mutex );
>   return add_edge(u, v, g.m_g);
> }
> 
> When I try to use it with G = adjacency_list< listS, vecS, directedS, 
> vertexs_properties, edges_properties >, I'm obtaining the follow compile 
> error message:
> 
> "error C2665: 'boost::add_edge' : none of the 2 overloads could convert 
> all the argument types"
> 
> It seems that the compiler can't find the right implementation of 
> add_edge(). It's strange, because I'm sure that the add_edge() exists 
> for adjacency_list<...>. The add_edge() version I've implementated is 
> only a wrapper of it.
> 
> Where I'm wrong? Is it a MSVC 2005 function resolution bug?
> 
I've found the add_edge() problem: I've defined 'const' the internal 
graph reference of sync_adjacency_list... without const, it works. This 
is the adaptor (the 'const' is now commented):
template <typename Graph>
class sync_adjacency_list {
   typedef graph_traits<Graph> Traits;
   typedef sync_adjacency_list<Graph> self;
public:
   typedef Graph graph_type;
   sync_adjacency_list( /*const*/ Graph& g) : m_g(g) { }
   // .....
   /*const*/ Graph& m_g;
}
Now, I'll test it...
Cosimo Calabrese.