|
Boost : |
From: artwisz_at_[hidden]
Date: 2001-03-25 07:00:10
Hello once again,
> artwis> One shortcut I thought of was simply to derive my graph
class from a
> artwis> specialized adjacency_list and overload all operations
tunneling most
> artwis> of them to the base class, but still I need to partially
specialize
> artwis> the property_map, so that I can write
> artwis>
> artwis> property_map<MyGraphType, vertex_bits_t>::type bits
> artwis> = get(vertex_bits, g);
> artwis>
> artwis> instead of
> artwis>
> artwis> property_map<MyGraphType::Base, vertex_bits_t>::type bits
> artwis> = get(vertex_bits, g);
> artwis>
I think I'm getting closer, I wrote my property selector:
struct bit_matrix_tag { };
template<class BitRep>
class bit_matrix : public boost::adjacency_list<...,
boost::property<
vertex_bits_t,
BitRep> >
{ ... };
struct bit_matrix_vertex_property_selector
{
template<class Graph, class Property, class PropertyTag>
struct bind
{
typedef typename Graph::Base BaseGraph;
typedef typename BaseGraph::graph_tag base_tag;
typedef typename
boost::vertex_property_selector<base_tag>::type
BaseSelector;
typedef typename Property::tag_type Tag;
typedef typename
BaseSelector::template bind<BaseGraph, Property, Tag>
Bind;
typedef typename Bind::type type;
typedef typename Bind::const_type const_type;
};
};
template<>
struct boost::vertex_property_selector<bit_matrix_tag>
{
typedef bit_matrix_vertex_property_selector type;
};
and it seems to bo OK. One thing that bothers me: why is there the
PropertyTag template param if I can deduce the PropertyTag from
Property ? I assume Property is an instance of struct property.
Perhaps it is possible to have a property that is not specialized
from struct property ?
Another thing I would like to do is to have some properties handled
by the base class and other by my derived class. I guess I would need
another layer of selectors... but this is fine at the moment.
BTW I can sniff a kind of meta-idiom in all that selectors stuff that
is itself worth a doc page.
Regards,
Art
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk