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-19 08:54:22


>
> What 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?

Unfortunately, I don't think such a function actually exists. However, if
you can detect these at compile time, you can easily reflect that as a
runtime query:

template <typename Graph, typename Prop>
bool has_property(Graph const& g)
{ return has_property_metafunc<Prop, Graph>::value; }

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