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: Juan Antonio Farré Basurte (jafb_at_[hidden])
Date: 2009-03-19 08:24:51

>> 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
>> and I need to provide the property map.
>> As I don't know what Graph implementation my template will be
>> 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.

about runtime detection? Would get(property_tag,graph) compile correctly
for an unexistant property? What would it return, then, at runtime if
the property
does not exist? a 0 pointer?



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at