Tims
Tims

Reputation: 641

Boost Directed Graph - add_edge - stored_edge_property

    typedef  boost::adjacency_list<
    boost::vecS, boost::vecS, boost::directedS, NodeInfo, EdgeInfo> Graph;

   Graph g(10);
   EdgeInfo be;
   add_edge(0,1,be,g);

Error: use of deleted function 'boost::detail::stored_edge_property

Changing "undirected" to "directed" causes error under linux (gcc/4.9.2) while compiles fine on windows visual studio express 2013. Boost: 1.59.0.

The culprit seems to be add_edge

Is there a quick fix?

Some forums have pointed to BGL incompatibilities with C++11 asking coders to revert to C++03. Is there an alternative?

Thanks

Upvotes: 1

Views: 303

Answers (1)

sehe
sehe

Reputation: 393064

I see no problem:

With the following graphs:

#include <boost/graph/adjacency_list.hpp>

struct NodeInfo { };
struct EdgeInfo { };

int main() {
    using namespace boost;
    {
        typedef adjacency_list<vecS, vecS, directedS, NodeInfo, EdgeInfo> Graph;
        Graph g(10);
    }
    {
        typedef adjacency_list<vecS, vecS, undirectedS, NodeInfo, EdgeInfo> Graph;
        Graph g(10);
    }
}

This tells me your problem is likely with the NodeInfo/EngeInfo types. If they are not copyable etc. this could lead to errors. MSVC might be more lenient than the standard requires (they frequently are in areas of name lookup and reference binding).

Upvotes: 1

Related Questions