Boost logo

Boost Users :

Subject: Re: [Boost-users] BGL Properties
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-01-27 13:25:09


On Thu, 27 Jan 2011, David Doria wrote:

>> You need to specify the vertex properties as empty (something like
>> "no_property" IIRC). You did specify the edge weight as the parameter of the
>> VertexProperties, but it should look like this:
>> adjacency_list<OutEdgeList, VertexList, Directed,
>>               VertexProperties, EdgeProperties,
>>               GraphProperties, EdgeList>
>>
>> The g++-4.3.4 output contains something like "Value =
>> boost::detail::error_property_not_found" which tells you that some property
>> was not available while you tried to access it.
>
> Cedric,
>
> Ah, thanks. One problem was I was indeed trying to specify the edge
> property type in the template parameter for the vertex property type.
>
> Now I am trying to simply assign a property to a vertex. I have:
>
> typedef boost::property<boost::vertex_property_tag, double>
> VertexProperty; // a double property
> typedef boost::adjacency_list<boost::vecS, boost::vecS,
> boost::undirectedS, VertexProperty> Graph;
>
> int main(int,char*[])
> {
> // Create a graph object
> Graph g(3);
>
> boost::add_vertex(g);
> boost::property_map<Graph, VertexProperty>::type value =
> get(VertexProperty(), g);
> boost::put(value, 0, 1.2);
> }
>
> On the property_map call, I get an "error: invalid use of void expression"

In property_map<> and get(), you need to use the property name (here
"boost::vertex_property" IIRC) rather than the full property specification
(property<>, which might actually be a list of properties).

-- Jeremiah Willcock


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