Boost logo

Boost Users :

From: Aaron Windsor (aaron.windsor_at_[hidden])
Date: 2007-06-06 21:14:06


On 6/6/07, gast128 <gast128_at_[hidden]> wrote:
> Aaron Windsor <aaron.windsor <at> gmail.com> writes:
>
> <snip>
>
> > My point in the previous email is that your graph doesn't have any
> > interior properties, but you're trying to access vertex properties -
> > this is what's causing the compile-time error. So, for instance, if
> > you added any bundled vertex property:
> >
> > struct vertex_properties { int label; };
> >
> > void Foo()
> > {
> > typedef boost::adjacency_list<boost::vecS, boost::listS,
> > boost::undirectedS, vertex_properties> graph_t;
> > graph_t graph;
> > graph_t::vertex_descriptor v = add_vertex(graph);
> > graph[v];
> > }
> >
> > It should compile.
> >
> > Regards,
> > Aaron
>
> Yes this compiles. So I switched back too my original code, and then it does
> not compile:
>
> namespace boost
> {
> enum vertex_HVERTEX_t { vertex_HVERTEX = 127 };
> BOOST_INSTALL_PROPERTY(vertex, HVERTEX);
> }
>
> void Foo()
> {
> typedef boost::property<boost::vertex_HVERTEX_t, int> prop_t;
> typedef boost::adjacency_list<boost::vecS, boost::listS,
> boost::undirectedS, prop_t> graph_t;
> graph_t graph;
>
> graph_t::vertex_descriptor v = add_vertex(graph);
> graph[v];
> }
>
> So some structs are more equal than other structs (since both boost::property
> as your vertex_properties are structures)?
>
> Wkr,
> me

Hi,

You're mixing the older interior graph properties with the syntax for
accessing bundled properties. If you use bundled properties, you can
access them with the [] operators, but you can't access the old-style
interior graph properties that way. You can read more about bundled
properties here:

http://www.boost.org/libs/graph/doc/bundles.html

and the older interior properties are documented here:

http://www.boost.org/libs/graph/doc/using_adjacency_list.html#sec:adjacency-list-properties

Regards,
Aaron


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