Ticket #3739: property_map.hpp.diff
File property_map.hpp.diff, 1.6 KB (added by , 13 years ago) |
---|
-
property_map.hpp
302 302 } 303 303 }; 304 304 305 struct identity_property_map; 305 template <typename T> 306 struct typed_identity_property_map; 306 307 307 308 // A helper class for constructing a property map 308 309 // from a class that implements operator[] … … 539 540 }; 540 541 541 542 //========================================================================= 542 // A property map that applies the identity function to integers543 struct identity_property_map544 : public boost::put_get_helper<std::size_t,545 identity_property_map>543 // A generalized identity property map 544 template <typename T> 545 struct typed_identity_property_map 546 : public boost::put_get_helper<T, typed_identity_property_map<T> > 546 547 { 547 typedef std::size_tkey_type;548 typedef std::size_tvalue_type;549 typedef std::size_treference;548 typedef T key_type; 549 typedef T value_type; 550 typedef T reference; 550 551 typedef boost::readable_property_map_tag category; 551 552 552 553 inline value_type operator[](const key_type& v) const { return v; } 553 554 }; 554 555 556 //========================================================================= 557 // A property map that applies the identity function to integers 558 typedef typed_identity_property_map<std::size_t> identity_property_map; 559 555 560 //========================================================================= 556 561 // A property map that does not do anything, for 557 562 // when you have to supply a property map, but don't need it.