Boost logo

Boost :

From: David Pearce (djp1_at_[hidden])
Date: 2003-05-23 05:59:57


Hi,

I've been attempting a proxy graph class. The idea is that maintains
a reference (or pointer) to some graph class and then simply forwards
on operations to that class. So, it looks very roughly like:

... add_edge(..., graph_ref<T> &g) {
  add_edge(..., g._g);
}

template<class T>
class graph_ref {
  private:
   T _g;
}

Now, I've run into the following problem regarding property_maps and
I'm wondering if there is any reasonable solution. Basically, what I
want to write is something like:

template<class T, class PropertyTag>
typename property_map<T, PropertyTag>::type
get(... , graph_ref<T> &g) {
   return get(... , g._g);
}

So i can basically just ignore the details of property maps. However,
this causes problems with classes as the return type is in terms of a
graph T, whereas the actual graph is a graph_ref<T>. e.g:

template<class T>
void some_fn(T &g) {
        typedef boost::property_map<T, ...>::type N2iMap;
        N2iMap n2i = get(..,g);
}

If the above is used with a graph_ref then it appears to break. I
guess this is because property_map<graph_ref<T>, ...> doesn't exist ??

Anyway, any ideas / help on this problem would be appreciated!

David Pearce


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk