|
Boost Users : |
From: Chuck Messenger (chuckm_at_[hidden])
Date: 2003-05-14 15:47:45
I've been testing out the BGL, and have found some small problems. Is
this a good forum to post these? If not, please set me straight. I
have in mind to post more of these -- in the interest of helping iron
out the library. Maybe the developer list would be more appropriate?
Or a BGL-specific list, if one exists...?
Problem 1: In the documentation, under "Using adjacency_list",
subsection "Custom Edge Properties", it shows a method for declaring a
custom property tag:
> struct flow_t {
> typedef edge_property_tag kind;
> };
>
> struct capacity_t {
> typedef edge_property_tag kind;
> };
It goes on to say that an alternative method is this:
> enum edge_myflow_t { edge_myflow };
> enum edge_mycapacity_t { edge_mycapacity };
>
> namespace boost {
> BOOST_INSTALL_PROPERTY(edge, myflow);
> BOOST_INSTALL_PROPERTY(edge, mycapacity);
> }
In the rest of the code included in the documentation, it uses the first
method. Finally, it says:
> The file edge_property.cpp shows the complete source code for this
example.
However, the code in edge_property.cpp is completely different -- using
the second method rather than the first. So, at a minimum, the final
sentence is wrong.
I suggest the alternative methods should both be shown in the sample
code. I made the necessary changes to edge_property.cpp -- here's the
diff (against Boost release 1.30.0):
78a79,88
> #define ALTERNATE // comment this out to see an alternate method
>
> #ifdef ALTERNATE
> struct flow_t {
> typedef edge_property_tag kind;
> };
> struct capacity_t {
> typedef edge_property_tag kind;
> };
> #else
86c96
<
--- > #endif 95c105,109 < property_map<Graph, edge_mycapacity_t>::const_type --- > #ifdef ALTERNATE > typename property_map<Graph, capacity_t>::const_type capacity = get(capacity_t(), G); > typename property_map<Graph, flow_t>::const_type flow = get(flow_t(), G); > #else > typename property_map<Graph, edge_mycapacity_t>::const_type 97c111 < property_map<Graph, edge_myflow_t>::const_type --- > typename property_map<Graph, edge_myflow_t>::const_type 98a113 > #endif 125a141,145 > #ifdef ALTERNATE > typedef property<capacity_t, int> Cap; > typedef property<flow_t, int, Cap> Flow; > typedef adjacency_list<vecS, vecS, bidirectionalS, no_property, Flow> Graph; > #else 129a150 > #endif 163a185,188 > #ifdef ALTERNATE > property_map<Graph, flow_t>::type > flow = get(flow_t(), G); > #else 165a191 > #endif Problem 2: edge_proprety.cpp, as included in Boost release 1.30.0, generates warnings under gcc 3.2.2, since it is missing a couple of typenames. Here's the needed patch: 95c95 < property_map<Graph, edge_mycapacity_t>::const_type --- > typename property_map<Graph, edge_mycapacity_t>::const_type 97c97 < property_map<Graph, edge_myflow_t>::const_type --- > typename property_map<Graph, edge_myflow_t>::const_type - Chuck
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