|
Boost : |
Subject: Re: [boost] [graph] porting code from 1.46 to 1.54
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2013-10-08 10:55:44
On Tue, 8 Oct 2013, Maurizio Vitale wrote:
> Hi Jeremiah,
> thanks for the suggestion. The code was using IndexGraph. This is code
> that was put in place way before I joined the company and the authors have
> long gone.
> Mikael's suggestion of rewriting the code using only the public interface
> is probably a good one, but I'll see if I can get this to work by declaring
> the property explicitly first.
There is probably also a simpler way to build the graph with the
properties you want; use this as the vertex property:
boost::property<boost::vertex_index_t, int, Instance*>
You should then still be able to use Instance* as a bundled property like
you did before, while having the vertex_index property as well.
-- Jeremiah Willcock
>
>
> On Mon, Oct 7, 2013 at 10:39 PM, Jeremiah Willcock <jewillco_at_[hidden]>wrote:
>
>> 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
>>
>>
>> ______________________________**_________________
>> Unsubscribe & other changes: http://lists.boost.org/**
>> mailman/listinfo.cgi/boost<http://lists.boost.org/mailman/listinfo.cgi/boost>
>>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk