
Hi, is there any reason, why boost::identity_property_map implementation in <boost\property_map.hpp> is completely different from how it is documented in http://www.boost.org/libs/property_map/identity_property_map.html ? As mentioned in the implementation, boost::identity_property_map is a property map that applies the identity function to integers. On the other hand, documentation clearly states that one can use identity_property_map with any types. Valentin Samko http://val.samko.info

On Wednesday 28 July 2004 5:11 pm, Val Samko wrote:
is there any reason, why boost::identity_property_map implementation in <boost\property_map.hpp> is completely different from how it is documented in http://www.boost.org/libs/property_map/identity_property_map.html ?
As mentioned in the implementation, boost::identity_property_map is a property map that applies the identity function to integers.
On the other hand, documentation clearly states that one can use identity_property_map with any types.
I don't know why the two are out-of-synch, but identity_property_map is essentially only used for adjacency lists when the vertices are stored in a vecS. In any case, I think the implementation is wrong (not generic enough) and the interface in the documentation is wrong (doesn't create property maps that we can adapt). I'd much rather see something like: template<typename T = void> struct identity_property_map { typedef T key_type; typedef T value_type; typedef T reference; typedef boost::readable_property_map_tag category; }; template<typename T, typename Key> T get(identity_property_map<T>, const Key& x) { return x; } The "identity_property_map<>" follows the behavior stated in the documentation, but "identity_property_map<T>" gives you a property map with useful key/value/reference types. But, of course, that's not backward-compatible. Doug
participants (2)
-
Doug Gregor
-
Val Samko