Boost logo

Boost Users :

Subject: Re: [Boost-users] Graph: create_subgraph not defined
From: Trevor Harmon (Trevor.W.Harmon_at_[hidden])
Date: 2010-06-29 17:38:41


On Jun 28, 2010, at 12:23 PM, Trevor Harmon wrote:

> #include <boost/graph/adjacency_list.hpp>
> #include <boost/graph/subgraph.hpp>
>
> using namespace boost;
>
> class MyVertex {
> public:
> virtual ~MyVertex() {}
> };
>
> class MyGraph :
> public subgraph<adjacency_list<vecS, vecS, bidirectionalS,
> shared_ptr<MyVertex>, property<edge_index_t, std::size_t> > > {
> };
>
> typedef property_map<MyGraph, edge_index_t>::type EdgeIndexMap;
>
> int main(int,char*[]) {
> MyGraph g;
> EdgeIndexMap edgeMap = get(edge_index, g);
> return 0;
> }

Hmm... If I change the EdgeIndexMap typedef so that MyGraph is simply
replaced by its superclass, then the code compiles. That is, I change
this:

typedef property_map<MyGraph, edge_index_t>::type EdgeIndexMap;

to this:

typedef property_map<subgraph<adjacency_list<vecS, vecS,
bidirectionalS, shared_ptr<MyVertex>, property<edge_index_t,
std::size_t> > >, edge_index_t>::type EdgeIndexMap;

I'm afraid my Boost-fu isn't very strong. Can someone please explain
this to me? Thanks,

Trevor


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