Boost logo

Boost :

Subject: Re: [boost] Boost::Graph --- why does this program not compile?
From: Oliver Kullmann (O.Kullmann_at_[hidden])
Date: 2009-01-30 09:02:36


On Fri, Jan 30, 2009 at 07:56:30AM -0500, Andrew Sutton wrote:
> >
> > However, changing
> >
> > Graph g(ev.begin(), ev.end(), 0, 0);
> >
> > to
> >
> > Graph g(ev.begin(), ev.end(), 0);
> >
> > makes it compile (which is not a possibility in my case, since
> > I need the optional argument).
> >
>
> It looks like the wrong constructor was instantiated. It looks like that
> first 0 is being substituted as an EdgePropertyIterator instead of the
> number of vertices, which I'm guessing is what you really want to do. If
> you're trying to set that last 0 as the number of edges, you don't *really*
> need that parameter. The constructor doesn't actually use it. It doesn't
> even give the parameter a name. The reason is that the iterator range
> defines the number of vertices.
>

I guess you mean the number of edges here.
 
> So, from what I can tell (assuming that I'm reading your intent correctly),
> the change that works will actually fix your problem.

This works now; thanks!

Shouldn't one then update the documentation?
For the first constructor of adjacency_list (in the documentation), the parameters

               edges_size_type m = 0,
               const GraphProperty& p = GraphProperty())

aren't explained, and at least m isn't used, and actually seems harmful?

The second constructor even has

               vertices_size_type m = 0,
               const GraphProperty& p = GraphProperty())

where likely it should be edges_size_type.

So some clean-up seems to be needed.

(Or is it the case, that nobody touches these original documentations
anymore??)

Thanks again.

Oliver

-- 
Dr. Oliver Kullmann
Computer Science Department
Swansea University
Faraday Building, Singleton Park
Swansea SA2 8PP, UK
http://cs.swan.ac.uk/~csoliver/

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk