Boost graph library constructor

Hello,
I am trying to construct a filtered graph in Boost Graph Library. The main steps of my code are the following:

I define the following types:

typedef adjacency_list<vecS, vecS, undirectedS, property<vertex_index_t, int>, no_property > Graph;
typedef filtered_graph<Graph, keep_all, vertex_id_filter<Graph> > fGraph;

and a filter to construct a filtered graph

template <typename TGraph>
struct vertex_id_filter{

vertex_id_filter() { }

bool operator()(const typename boost::graph_traits<TGraph>::vertex_descriptor& v) const
{
if(m_memb[v] == m_idC){return 1;}
else{return 0;}
}
int * m_memb, m_idC;
};


Now I construct a Graph object G

Graph G(N);

and a vertex_id_filter object

vertex_id_filter<Graph> filter;

and I finally construct a filtered graph

fGraph fG(G, keep_all(), filter);

Later in the code, I want to construct another fGgraph object with a different filter -- say filter2. I would like to do this without explicitly creating a new fGraph object, i.e. I would like to avoid writing
fGraph fG2(G, keep_all(), filter2);

Rather than that, I would like to overwrite fG: I tried

fG = fGraph(G, keep_all(), filter2);

but it does not compile.

Best.

but it does not compile.
Yes, the class doesn't allow that. Why is it a problem to create another variable?
Because I have to do it many tines and the the code blows up with many different symbols.is there a way to define a copy constructor?
In order to use a copy constructor you need to construct a new variable, but that's what you don't want.

You may check out whether you can change the filter of fG directly.
Or you use a pointer.

But it rather sounds like a misconception
Thank you for your reply. How about using copy_graph?

copy_graph(fG,fGraph(G, keep_all(), filter2));

I have tried but it doesn't compile... The copy_graph command works fine for non filtered graph, but it doesn't work for filtered graph: I don't know how to copy a filtered graph.
Topic archived. No new replies allowed.