Ticket #6543: property_map_hpp.patch

File property_map_hpp.patch, 1.9 KB (added by Alex Hagen-Zanker <ahh34@…>, 11 years ago)

patch to property_map.hpp

  • property_map.hpp

     
    590590  };
    591591
    592592//=========================================================================
    593   // A property map that applies the identity function to integers
    594   typedef typed_identity_property_map<std::size_t> identity_property_map;
     593  // A property map returns a copy of the key
     594  // It is overloaded to do so for any type
     595  // but, consequently does not provide correct property_traits
     596  struct identity_property_map
     597  {
     598    typedef size_t no_type; // should this be void instead?
     599    typedef no_type key_type;
     600    typedef no_type value_type;
     601    typedef no_type reference;
     602    typedef boost::readable_property_map_tag category;
    595603
     604    template<typename T>
     605    inline T operator[](const T& k) const
     606    {
     607      return k;
     608    }
     609  };
     610
     611  template<typename T>
     612  T get(identity_property_map, const T& k)
     613  {
     614    return k;
     615  }
     616 
     617  // A property map returns a reference to the key
     618  // It is overloaded to do so for any type
     619  // but, consequently does not provide correct property_traits
     620  struct identity_ref_property_map
     621  {
     622    typedef size_t no_type;// should this be void instead?
     623    typedef no_type key_type;
     624    typedef no_type value_type;
     625    typedef no_type reference;
     626    typedef boost::lvalue_property_map_tag category;
     627
     628    template<typename T>
     629    inline T& operator[](T& k) const
     630    {
     631      return k;
     632    }
     633  };
     634
     635  template<typename T>
     636  T& get(identity_ref_property_map, T& k)
     637  {
     638    return k;
     639  }
     640 
     641  template<typename T>
     642  void put(identity_ref_property_map, T& k, const T& v)
     643  {
     644    k = v;
     645  }
     646 
    596647  //=========================================================================
    597648  // A property map that does not do anything, for
    598649  // when you have to supply a property map, but don't need it.