Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58246 - trunk/boost/property_map
From: jewillco_at_[hidden]
Date: 2009-12-08 22:45:43


Author: jewillco
Date: 2009-12-08 22:45:42 EST (Tue, 08 Dec 2009)
New Revision: 58246
URL: http://svn.boost.org/trac/boost/changeset/58246

Log:
Applied patch from #3739; fixes #3739
Text files modified:
   trunk/boost/property_map/property_map.hpp | 21 +++++++++++++--------
   1 files changed, 13 insertions(+), 8 deletions(-)

Modified: trunk/boost/property_map/property_map.hpp
==============================================================================
--- trunk/boost/property_map/property_map.hpp (original)
+++ trunk/boost/property_map/property_map.hpp 2009-12-08 22:45:42 EST (Tue, 08 Dec 2009)
@@ -302,7 +302,8 @@
     }
   };
 
- struct identity_property_map;
+ template <typename T>
+ struct typed_identity_property_map;
 
   // A helper class for constructing a property map
   // from a class that implements operator[]
@@ -539,19 +540,23 @@
   };
 
   //=========================================================================
- // A property map that applies the identity function to integers
- struct identity_property_map
- : public boost::put_get_helper<std::size_t,
- identity_property_map>
+ // A generalized identity property map
+ template <typename T>
+ struct typed_identity_property_map
+ : public boost::put_get_helper<T, typed_identity_property_map<T> >
   {
- typedef std::size_t key_type;
- typedef std::size_t value_type;
- typedef std::size_t reference;
+ typedef T key_type;
+ typedef T value_type;
+ typedef T reference;
     typedef boost::readable_property_map_tag category;
 
     inline value_type operator[](const key_type& v) const { return v; }
   };
 
+//=========================================================================
+ // A property map that applies the identity function to integers
+ typedef typed_identity_property_map<std::size_t> identity_property_map;
+
   //=========================================================================
   // A property map that does not do anything, for
   // when you have to supply a property map, but don't need it.


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk