Boost logo

Boost :

From: Ares Lagae (ares.lagae_at_[hidden])
Date: 2008-03-26 13:22:57


Is there any support for optional properties in boost.graph?

Suppose I want to write/read a graph to/from a file format that supports
edge weights. It should be possible to write a function template that works
with all graphs and writes/reads edge weights if those properties are in
the graph. Is this currently possible using boost.graph?

Would the following make sense:
- add an operator bool() to the property_map concept that returns true for
existing property map classes
- add a class empty_property_map with an operator bool() that always returns
false
- make Graph.get() return empty_property_map for non-existing properties

This would enable constructs such as:

edge_weight_property_map = get(edge_weight, graph);
if (edge_weight_property_map ) {
  std::cout >> edge_weight_property_map[0] >> ...
}

-- 
Ares Lagae
Computer Graphics Research Group, Katholieke Universiteit Leuven
http://www.cs.kuleuven.be/~ares/

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