diff --git a/Hash_map/include/CGAL/Unique_hash_map.h b/Hash_map/include/CGAL/Unique_hash_map.h index 4ca3b645926..8a7ab5ad799 100644 --- a/Hash_map/include/CGAL/Unique_hash_map.h +++ b/Hash_map/include/CGAL/Unique_hash_map.h @@ -129,49 +129,54 @@ namespace boost { struct lvalue_property_map_tag; - template - class associative_property_map > + template + class associative_property_map > { - typedef CGAL::Unique_hash_map C; + typedef CGAL::Unique_hash_map C; + public: typedef KeyType key_type; typedef ValueType value_type; - typedef value_type& reference; + typedef const value_type& reference; typedef lvalue_property_map_tag category; associative_property_map() : m_c(0) { } associative_property_map(C& c) : m_c(&c) { } - reference operator[](const key_type& k) const { + value_type& operator[](const key_type& k) const { return (*m_c)[k]; } - private: - C* m_c; - }; - - template - associative_property_map > - make_assoc_property_map(CGAL::Unique_hash_map & c) - { - return associative_property_map >(c); - } - - - template - ValueType& get(const associative_property_map >& uhm, const KeyType& key) + friend + const value_type& + get(const associative_property_map& uhm, const key_type& key) { return uhm[key]; } - - template - void put(associative_property_map >& uhm, const KeyType& key, const ValueType& val) + + friend + void + put(associative_property_map& uhm, const key_type& key, const value_type& val) { uhm[key] = val; } + private: + C* m_c; + }; + + template + associative_property_map > + make_assoc_property_map(CGAL::Unique_hash_map& c) + { + return associative_property_map >(c); + } } - - #endif // CGAL_UNIQUE_HASH_MAP_H // EOF