Boost logo

Boost Users :

Subject: [Boost-users] [graph] Looks like there is a bug in some graph-writing function
From: Juan Antonio Farré Basurte (jafb_at_[hidden])
Date: 2009-03-17 12:15:17


>
>
> Hi,
>
> I was correctly reading graphs in graphml and graphviz.
> Now I've added support for
graph writing.
> And now I get tons of
> errors at the last line of my code (I mean symbol '}').
>
> After looking
carefully at them looks like there are two families of errors,
> all of them related to property maps:
>
> - Looks like
property maps are being accessed for reading using operator[].
> But if the
> property map is backed by std::map, it's documented
that operator[]
> in fact does an insert in the map. This is not a problem when reading a
> graph,
> as the graph is
mutable. But of course it is a problem when writing a const graph.
> I get tons of errors about modifying read-only
> locations and
discarding qualifiers (const, of course).
>
> - The other errors are about not finding a matching operator>>, also
>
related with properties.
> In this case, it looks to be related with reading (and I think concretely graphviz), but I don't understand
> why,
> as it used to work before. May be this is a cryptic bug of my code.
>
> I don't find clear information in the
errors about what graph writing
> function is causing the first family
> of errors. I can attach compiler output, but I'm afraid
messages are in Spanish :S
> Moreover, I'm not
> sure if it's correct to send attached files to the list.
> If anybody wants
me to send it, just ask.
>

I've been able to locate the exact origin point of the error. It hasn't been easy.
It isn't a
problem of graph writing functions. The problem is in sentences like this:

           
dp.property("min",get(&V::min,g));

where dp is a reference to a dynamic_properties object, g is a const reference to a
graph and
V is the type of vertex bundled properties of graph g (min is one of those properties).
Commenting out all lines like this,
everything compiles perfectly.
Looks like, somehow, that sentence tries to modify properties in graph g
and, as g is const, it fails to
compile. Is there any workaround?

Thanks,

Juan



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net