From f32b291f0bbcf96a4946c248e0128f497d82325f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 6 Jul 2016 16:27:15 +0200 Subject: [PATCH 1/3] improve specialization of boost::associative_property_map for Unique_hash_map --- Hash_map/include/CGAL/Unique_hash_map.h | 29 ++++++++++++------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Hash_map/include/CGAL/Unique_hash_map.h b/Hash_map/include/CGAL/Unique_hash_map.h index 4ca3b645926..d0419884522 100644 --- a/Hash_map/include/CGAL/Unique_hash_map.h +++ b/Hash_map/include/CGAL/Unique_hash_map.h @@ -136,13 +136,25 @@ namespace boost { 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]; } + + friend const ValueType& get(const associative_property_map >& uhm, const KeyType& key) + { + return uhm[key]; + } + + friend + void put(associative_property_map >& uhm, const KeyType& key, const ValueType& val) + { + uhm[key] = val; + } + private: C* m_c; }; @@ -154,19 +166,6 @@ namespace boost { { return associative_property_map >(c); } - - - template - ValueType& get(const associative_property_map >& uhm, const KeyType& key) - { - return uhm[key]; - } - - template - void put(associative_property_map >& uhm, const KeyType& key, const ValueType& val) - { - uhm[key] = val; - } } From 0f97115ce8628ceaa832e78e4cda7f4975f72715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 24 Oct 2016 10:31:53 +0200 Subject: [PATCH 2/3] Polish --- Hash_map/include/CGAL/Unique_hash_map.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Hash_map/include/CGAL/Unique_hash_map.h b/Hash_map/include/CGAL/Unique_hash_map.h index d0419884522..82d749be65c 100644 --- a/Hash_map/include/CGAL/Unique_hash_map.h +++ b/Hash_map/include/CGAL/Unique_hash_map.h @@ -144,13 +144,18 @@ namespace boost { return (*m_c)[k]; } - friend const 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]; } friend - void put(associative_property_map >& uhm, const KeyType& key, const ValueType& val) + void + put(associative_property_map >& uhm, + const key_type& key, const value_type& val) { uhm[key] = val; } From 3016548bad863e8970c2416396e053f70a524a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 21 Oct 2016 17:52:44 +0200 Subject: [PATCH 3/3] Fix the specialization of Boost's assoc_pmap using CGAL::Unique_hash_map The default template parameters of the hash map were taken. --- Hash_map/include/CGAL/Unique_hash_map.h | 31 +++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Hash_map/include/CGAL/Unique_hash_map.h b/Hash_map/include/CGAL/Unique_hash_map.h index 82d749be65c..8a7ab5ad799 100644 --- a/Hash_map/include/CGAL/Unique_hash_map.h +++ b/Hash_map/include/CGAL/Unique_hash_map.h @@ -129,10 +129,13 @@ 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; @@ -146,16 +149,14 @@ namespace boost { friend const value_type& - get(const associative_property_map >& uhm, - const key_type& key) + get(const associative_property_map& uhm, const key_type& key) { return uhm[key]; } friend void - put(associative_property_map >& uhm, - const key_type& key, const value_type& val) + put(associative_property_map& uhm, const key_type& key, const value_type& val) { uhm[key] = val; } @@ -164,18 +165,18 @@ namespace boost { C* m_c; }; - - template - associative_property_map > - make_assoc_property_map(CGAL::Unique_hash_map & c) + template + associative_property_map > + make_assoc_property_map(CGAL::Unique_hash_map& c) { - return associative_property_map >(c); + return associative_property_map >(c); } - } - - #endif // CGAL_UNIQUE_HASH_MAP_H // EOF