Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77467 - sandbox-branches/birbacher/propertymap-functormap/boost/property_map
From: frank.birbacher_at_[hidden]
Date: 2012-03-21 18:42:17


Author: birbacher
Date: 2012-03-21 18:42:16 EDT (Wed, 21 Mar 2012)
New Revision: 77467
URL: http://svn.boost.org/trac/boost/changeset/77467

Log:
Added property map implementation for boost::function1.

Text files modified:
   sandbox-branches/birbacher/propertymap-functormap/boost/property_map/functor_property_map.hpp | 15 +++++++++++++++
   1 files changed, 15 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:42:16 EDT (Wed, 21 Mar 2012)
@@ -53,6 +53,21 @@
   }
 #endif // have partial specialization
 
+ // Portable syntax
+ template <typename Key, typename Value>
+ struct property_traits<function1<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(function1<Value, Key> const& f, Key const key)
+ {
+ return f(key);
+ }
+
 } // namespace boost
 
 #endif /* BOOST_FUNCTOR_PROPERTY_MAP_HPP */


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