I have been fiddling with this library off and on for some time ... now am
getting this error:
/home/eric/boostplay/g0/src/g0.cpp:55: error: no matching function for call
to 'add_vertex(Graph (&)())'
/home/eric/boostplay/g0/src/g0.cpp:56: error: no matching function for call
to 'add_edge(Vertex&, Vertex&, Graph (&)())'
on this code:
#ifdef HAVE_CONFIG_H
#include
#endif
#include <iostream>
#include <cstdlib>
#include
#include
#include
using namespace std;
using namespace boost;
typedef adjacency_list Graph;
typedef graph_traits<Graph>::vertex_descriptor Vertex;
typedef graph_traits<Graph>::edge_descriptor Edge;
int main(int argc, char *argv[])
{
Graph g();
Vertex v = 0;
for(int iv = 0; iv < 10; ++iv)
for(int iu = 0; iu < 5; ++iu)
{
Vertex u;
Edge e;
bool inserted;
u = v;
tie(v, inserted) = add_vertex(g);
tie(e, inserted) = add_edge(u, v, g);
if(inserted)
cout << "Inserted edge " << e << " from vertex " << u << " to
vertex " << v << endl;
else
cout << "Failed to insert edge " << e << " from vertex " << u
<< " to vertex " << v << endl;
}
return EXIT_SUCCESS;
}
There was a thread on this a while back which suggested casting the call:
tie(e, inserted) = add_edge(u, v, g);
to
tie(e, inserted) = add_edge(std::size_t(u), std::size_t(v), g);
but that did not work.
Notice my graph has no properties .. usually I don't make 'em that way, but
that should be fine, right?
Thanks very much,
Eric