Boost logo

Boost :

Subject: Re: [boost] [graph] porting code from 1.46 to 1.54
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2013-10-07 22:39:08


On Mon, 7 Oct 2013, Maurizio Vitale wrote:

> Hello boost,
>
> I'm trying to move some large code base to use boost 1.54.
>
> In some dark corner of it, the following was compiling fine:
>
> class Instance;
>
> typedef boost::setS OutEdgeList;
> typedef boost::listS VertexList;
>
> struct InstancePropertyTag {
> typedef boost::vertex_property_tag kind;
> };
>
> typedef boost::property<InstancePropertyTag, Instance*> InstanceProperty;
> typedef boost::adjacency_list<OutEdgeList, VertexList,
> boost::bidirectionalS, InstanceProperty> Graph;
> typedef boost::property_map<Graph, boost::vertex_index_t>::type IndexGraph;
>
> under 1.54, I get 'attempt to form reference to void', but everything was
> fine under 1.46.
>
> I traced it a bit through template expansion, and the problem seems to be
> that the type for vertex_index_t is not found.
> The following declaration for InstanceProperty fixes (or hides) the problem:
>
> typedef boost::property<InstancePropertyTag, Instance*,
> boost::property<boost::vertex_index_t, int> > InstanceProperty;
>
> Does somebody know if some properties were added by default to graphs
> before and need to be explicitly added now?
> I don't find anything in the documentation and all examples I've found seem
> to imply that one wouldn't need to explicitly
> add a property declaration of vertex_index_t.

The vertex_index property is not added to adjacency list graphs with listS
as vertex container (and was not before). Did the code ever try to use
IndexGraph previously? It is unlikely to have worked. The fix you made
is the correct one; be sure to initialize that property if you are going
to call algorithms that use it.

-- Jeremiah Willcock


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