
On Mon, 28 Feb 2011, Tony Cook wrote:
Hi, The following test program highlights an compilation error issue when using a boost::filtered_graph to access graph properties. I am using Boost 1.46.0
#include <boost/graph/adjacency_list.hpp> #include <boost/graph/filtered_graph.hpp>
class TestGraph { class VertexProperties { public: bool mFlag ; } ; class EdgeProperties { public: bool mFlag ; } ; class GraphProperties { public: bool mFlag ; } ;
typedef boost::adjacency_list <boost::vecS, boost::listS, boost::undirectedS, EdgeProperties, VertexProperties, GraphProperties> GraphType ;
template <typename GraphType> class EdgePredicate { public: EdgePredicate () : mpGraph (0) {} public: EdgePredicate (GraphType& vrGraph) : mpGraph (&vrGraph) {} public: template <typename EdgeType> bool operator()(const EdgeType& vEdge) const { return (*mpGraph)[vEdge].mFlag ; } private: GraphType* mpGraph ; } ;
template <typename GraphType> class VertexPredicate { public: VertexPredicate () : mpGraph (0) {} public: VertexPredicate (GraphType& vrGraph) : mpGraph (&vrGraph) {} public: template <typename VertexType> bool operator()(const VertexType& vVertex) const { return (*mpGraph)[vVertex].mFlag ; } private: GraphType* mpGraph ; } ;
typedef boost::filtered_graph<GraphType, EdgePredicate<GraphType>, VertexPredicate<GraphType> > FilteredGraphType ;
...
void foo () { GraphType graph ; FilteredGraphType filter (graph, EdgePredicate<GraphType> (graph), VertexPredicate<GraphType> (graph)) ;
graph [boost::graph_bundle].mFlag = true ; filter [boost::graph_bundle].mFlag ; // ***** Does not compile - see below ... } }
Could you please see if this problem still appears in r69404 of the Boost trunk (just committed)? If you are using a release, you only need to get boost/graph/properties.hpp and boost/graph/graph_traits.hpp from the trunk and overwrite your copies. I believe I have fixed the bug -- your example from above compiles, at least. -- Jeremiah Willcock