Boost logo

Boost :

Subject: [boost] [BGL] [PropertyMap] Key param is passed by value in put function
From: Cosimo Calabrese (cosimo.calabrese_at_[hidden])
Date: 2009-11-18 05:59:20

Hi to all,

I've noticed that the put function that takes a generic put_get_helper
map, takes a key param. The question is: why the key param is passed by
value? Is any reason for this? The key value is not modified setting the
property map.

I've noticed it because in my graph type the descriptors are variant,
and so every time I've to set a property map, a new copy of the variant
is created.

I've reported the function below, for sake of comfort. It is in

   template <class PropertyMap, class Reference, class K, class V>
   inline void
   put(const put_get_helper<Reference, PropertyMap>& pa, K k, const V& v)
     static_cast<const PropertyMap&>(pa)[k] = v;

Best regards,
Cosimo Calabrese

Boost list run by bdawes at, gregod at, cpdaniel at, john at