Boost logo

Boost Users :

Subject: [Boost-users] graph: PropertyMap needs lvalue for vertex_index
From: Jens Weller (JensWeller_at_[hidden])
Date: 2010-09-21 08:50:57


Hi,

I've been playing arround with boost::graph (and the layout algorithms in special).
Now I encountered a little problem, I'm trying to get Kamada Kawai Spring to work, but I do get an compile error when calling put for vertex_index.
So, this problem has nothing to do with KKS.

My Code:
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS,
                         // Vertex properties
boost::property<boost::vertex_index_t, int,
boost::property<vertex_position_t, point> >
                         // Edge properties
,boost::property<boost::edge_weight_t, double>
> Graph;

Graph g(scene->getNodeCount());
boost::graph_traits<Graph>::vertex_iterator vi,vi_end;
int i = 0;
for (boost::tie(vi, vi_end) = boost::vertices(g); vi != vi_end; ++vi)
    boost::put(boost::vertex_index, g, *vi, i++);

put throws now a compile Error:
..\..\..\cpp\boost_1_43/boost/property_map/property_map.hpp:361: error: lvalue required as left operand of assignment

The last argument of put does throw this error.
I expected the code to work, as I have copied it out of the layout_tests file:
http://www.boost.org/doc/libs/1_43_0/libs/graph/test/layout_test.cpp

So, where is my error here?
I tried some different versions and some casts, but none made this code work.
And I don't think that something that trivial is broken in the testcases.

regards,

Jens Weller

-- 
GRATIS: Spider-Man 1-3 sowie 300 weitere Videos!
Jetzt freischalten! http://portal.gmx.net/de/go/maxdome

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