Boost logo

Boost Users :

Subject: Re: [Boost-users] Compilation error using boost::filtered_graph when trying to access graph properties via boost::graph_bundle
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-02-28 17:43:09


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


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