$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r77465 - sandbox-branches/birbacher/propertymap-functormap/boost/property_map
From: frank.birbacher_at_[hidden]
Date: 2012-03-21 18:38:53
Author: birbacher
Date: 2012-03-21 18:38:53 EDT (Wed, 21 Mar 2012)
New Revision: 77465
URL: http://svn.boost.org/trac/boost/changeset/77465
Log:
Implemented property map for boost::function.
Text files modified: 
   sandbox-branches/birbacher/propertymap-functormap/boost/property_map/functor_property_map.hpp |    19 +++++++++++++++++++                     
   1 files changed, 19 insertions(+), 0 deletions(-)
Modified: sandbox-branches/birbacher/propertymap-functormap/boost/property_map/functor_property_map.hpp
==============================================================================
--- sandbox-branches/birbacher/propertymap-functormap/boost/property_map/functor_property_map.hpp	(original)
+++ sandbox-branches/birbacher/propertymap-functormap/boost/property_map/functor_property_map.hpp	2012-03-21 18:38:53 EDT (Wed, 21 Mar 2012)
@@ -11,6 +11,8 @@
 #define BOOST_FUNCTOR_PROPERTY_MAP_HPP
 
 #include <boost/property_map/property_map.hpp>
+#include <boost/function/function_fwd.hpp>
+#include <boost/type_traits/add_lvalue_reference.hpp>
 
 namespace boost {
 
@@ -34,6 +36,23 @@
     return PA(f);
   }
 
+#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX)
+  // Preferred syntax
+  template <typename Key, typename Value>
+  struct property_traits<function<Value(Key)> > {
+    typedef Key key_type;
+    typedef Value value_type; 
+    typedef typename add_lvalue_reference<Value>::type reference;
+    typedef readable_property_map_tag category;
+  };
+  
+  template<typename Key, typename Value>
+  inline Value get(function<Value(Key)> const& f, Key const key)
+  {
+	return f(key);
+  }  
+#endif // have partial specialization
+
 } // namespace boost
 
 #endif /* BOOST_FUNCTOR_PROPERTY_MAP_HPP */