
Dear all, We want to (DLL) export a boost graph. Probably on (DLL) exporting, the compiler tries to generate code for every member function. However on VC++7.1 it gives then a problem with operator[]. This can be easily verified with the following case: void Foo() { boost::adjacency_list<> graph; graph[0]; } We use here Boost 1.33.0. Anyone an idea? Wkr, me

On 6/4/07, gast128 <gast128@hotmail.com> wrote:
Dear all,
We want to (DLL) export a boost graph. Probably on (DLL) exporting, the compiler tries to generate code for every member function. However on VC++7.1 it gives then a problem with operator[]. This can be easily verified with the following case:
void Foo() { boost::adjacency_list<> graph; graph[0]; }
We use here Boost 1.33.0. Anyone an idea?
Wkr, me
Hi, What are you expecting the expression "graph[0]" to do/return in the code above? Regards, Aaron

Aaron Windsor <aaron.windsor <at> gmail.com> writes:
On 6/4/07, gast128 <gast128 <at> hotmail.com> wrote:
Dear all,
We want to (DLL) export a boost graph. Probably on (DLL) exporting, the compiler tries to generate code for every member function. However on
it gives then a problem with operator[]. This can be easily verified with
VC++7.1 the
following case:
void Foo() { boost::adjacency_list<> graph; graph[0]; }
We use here Boost 1.33.0. Anyone an idea?
Wkr, me
Hi,
What are you expecting the expression "graph[0]" to do/return in the code above?
Regards, Aaron
Nothing. It won't compile, complaining about return type. Same error if you try to export an adjacency_list. Wkr, me

On 6/5/07, gast128 <gast128@hotmail.com> wrote:
Aaron Windsor <aaron.windsor <at> gmail.com> writes:
On 6/4/07, gast128 <gast128 <at> hotmail.com> wrote:
Dear all,
We want to (DLL) export a boost graph. Probably on (DLL) exporting, the compiler tries to generate code for every member function. However on
it gives then a problem with operator[]. This can be easily verified with
VC++7.1 the
following case:
void Foo() { boost::adjacency_list<> graph; graph[0]; }
We use here Boost 1.33.0. Anyone an idea?
Wkr, me
Hi,
What are you expecting the expression "graph[0]" to do/return in the code above?
Regards, Aaron
Nothing. It won't compile, complaining about return type. Same error if you try to export an adjacency_list.
Wkr, me
graph[0] accesses the bundled properties for the first vertex in the graph, but you've declared an empty graph with no properties. So, even if you got it to compile by adding some properties to the graph, 0 still isn't even a valid vertex descriptor, since the graph is empty. Regards, Aaron

Aaron Windsor <aaron.windsor <at> gmail.com> writes:
On 6/5/07, gast128 <gast128 <at> hotmail.com> wrote:
Aaron Windsor <aaron.windsor <at> gmail.com> writes:
On 6/4/07, gast128 <gast128 <at> hotmail.com> wrote:
Dear all,
We want to (DLL) export a boost graph. Probably on (DLL) exporting, the compiler tries to generate code for every member function. However on
VC++7.1
it gives then a problem with operator[]. This can be easily verified
with
the
following case:
void Foo() { boost::adjacency_list<> graph; graph[0]; }
We use here Boost 1.33.0. Anyone an idea?
Wkr, me
Hi,
What are you expecting the expression "graph[0]" to do/return in the code above?
Regards, Aaron
Nothing. It won't compile, complaining about return type. Same error if you try to export an adjacency_list.
Wkr, me
graph[0] accesses the bundled properties for the first vertex in the graph, but you've declared an empty graph with no properties. So, even if you got it to compile by adding some properties to the graph, 0 still isn't even a valid vertex descriptor, since the graph is empty.
Regards, Aaron
But that 's the problem I can't get it compile, even if I don't use an empty graph, e.g.: void Foo() { boost::adjacency_list<> graph; boost::adjacency_list<>::vertex_descriptor v = add_vertex(graph); graph[v]; } c:\Work Sdk\Boost\boost\graph\adjacency_list.hpp(412) : error C2440: 'return' : cannot convert from 'boost::vec_adj_list_any_vertex_pa::bind_<Tag,Graph,Property>::value_type' to 'boost::adjacency_list<>::vertex_bundled &' with [ Tag=boost::vertex_bundle_t, Graph=boost::adjacency_list<>, Property=boost::detail::vertex_property_map<boost::adjacency_list<>,boost::vert ex_bundle_t>::Property ] A reference that is not to 'const' cannot be bound to a non-lvalue c:\Work Sdk\Boost\boost\graph\adjacency_list.hpp(412) : while compiling class-template member function 'boost::adjacency_list<>::vertex_bundled &boost::adjacency_list<>::operator [] (boost::adjacency_list<>::vertex_descriptor)' c:\Work\Test\Testmfc\Test Boost Graph\KTestBoostGrphCompileError.cpp (26) : see reference to class template instantiation 'boost::adjacency_list<>' being compiled Wkr, me

On 6/6/07, gast128 <gast128@hotmail.com> wrote:
Aaron Windsor <aaron.windsor <at> gmail.com> writes:
On 6/5/07, gast128 <gast128 <at> hotmail.com> wrote:
Aaron Windsor <aaron.windsor <at> gmail.com> writes:
On 6/4/07, gast128 <gast128 <at> hotmail.com> wrote:
Dear all,
We want to (DLL) export a boost graph. Probably on (DLL) exporting, the compiler tries to generate code for every member function. However on
VC++7.1
it gives then a problem with operator[]. This can be easily verified
with
the
following case:
void Foo() { boost::adjacency_list<> graph; graph[0]; }
We use here Boost 1.33.0. Anyone an idea?
Wkr, me
Hi,
What are you expecting the expression "graph[0]" to do/return in the code above?
Regards, Aaron
Nothing. It won't compile, complaining about return type. Same error if you try to export an adjacency_list.
Wkr, me
graph[0] accesses the bundled properties for the first vertex in the graph, but you've declared an empty graph with no properties. So, even if you got it to compile by adding some properties to the graph, 0 still isn't even a valid vertex descriptor, since the graph is empty.
Regards, Aaron
But that 's the problem I can't get it compile, even if I don't use an empty graph, e.g.:
void Foo() { boost::adjacency_list<> graph; boost::adjacency_list<>::vertex_descriptor v = add_vertex(graph); graph[v]; }
<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

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

On 6/6/07, gast128 <gast128@hotmail.com> 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-... Regards, Aaron

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-
<snip> list-properties
Regards, Aaron
ok thx. The problem arose not because I used directly the operator[], but because I explicitly instantiated all members. It would at least help me if a simple wrapper was build around the boost graph. We don't use all advanced features, just a fairly simple unweighted directed graph (average 2-10 vertices) and only want to detect connectivity and cycles. The vertices should have stable vertex descriptors (if one makes a copy of the graph). wkr, me
participants (2)
-
Aaron Windsor
-
gast128