Boost logo

Boost Users :

Subject: Re: [Boost-users] [graph] How to find out at compile time if a graph has some concrete internal property?
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2009-03-16 08:54:20


>
> I need to use the topological_sort BGL algorithm.
> This algorithm needs either that the graph has an internal vertex index
> property or that you provide a property map for it.
> I'd like to perform conditional compilation, so that I only build and
> provide the vertex index property map when it's needed,
> and the internal index property of the graph when it has it.
> For example, for an adjacency_list with vecS for VertexList,
> the property already exists in the graph and I wouldn't like to provide a
> property map for it.
> But if I choose listS for VertexList, there isn't such internal property
> and I need to provide the property map.
> As I don't know what Graph implementation my template will be provided,
> I need to find a way to know at compile time if that graph has the internal
> index property or not.
> Is there any (documented?) way to do it?
> This is the concrete information I need right now, but, if possible,
> I'd like to know how to find out if the graph has any concrete internal
> property, and not only the index one.
>

I don't think that this is really documented anywhere... You might look at
pending/property.hpp - there are number of metafunctions there that might be
useful. Specifically, I think you'd be looking at property_value, which
appears to extract a property from a property list. This may "return"
no_property if the requested kind is not supported.

Andrew Sutton
andrew.n.sutton_at_[hidden]



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