mirror of https://github.com/CGAL/cgal
Merge pull request #1612 from MaelRL/Hash_map-Fix_Unique_hmap_specialization_of_boost_assoc_map
Fix the Unique_hash_map specialization of boost's associative property map
This commit is contained in:
commit
d2ea0f90b3
|
|
@ -129,49 +129,54 @@ namespace boost {
|
|||
|
||||
struct lvalue_property_map_tag;
|
||||
|
||||
template <typename KeyType, typename ValueType>
|
||||
class associative_property_map<CGAL::Unique_hash_map<KeyType,ValueType> >
|
||||
template <typename KeyType, typename ValueType,
|
||||
typename HashFunction, typename Allocator>
|
||||
class associative_property_map<CGAL::Unique_hash_map<KeyType, ValueType,
|
||||
HashFunction, Allocator> >
|
||||
{
|
||||
typedef CGAL::Unique_hash_map<KeyType,ValueType> C;
|
||||
typedef CGAL::Unique_hash_map<KeyType, ValueType, HashFunction, Allocator> 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 <typename KeyType, typename ValueType>
|
||||
associative_property_map<CGAL::Unique_hash_map<KeyType,ValueType> >
|
||||
make_assoc_property_map(CGAL::Unique_hash_map<KeyType,ValueType> & c)
|
||||
{
|
||||
return associative_property_map<CGAL::Unique_hash_map<KeyType,ValueType> >(c);
|
||||
}
|
||||
|
||||
|
||||
template <typename KeyType, typename ValueType>
|
||||
ValueType& get(const associative_property_map<CGAL::Unique_hash_map<KeyType,ValueType> >& uhm, const KeyType& key)
|
||||
friend
|
||||
const value_type&
|
||||
get(const associative_property_map<C>& uhm, const key_type& key)
|
||||
{
|
||||
return uhm[key];
|
||||
}
|
||||
|
||||
template <typename KeyType, typename ValueType>
|
||||
void put(associative_property_map<CGAL::Unique_hash_map<KeyType,ValueType> >& uhm, const KeyType& key, const ValueType& val)
|
||||
|
||||
friend
|
||||
void
|
||||
put(associative_property_map<C>& uhm, const key_type& key, const value_type& val)
|
||||
{
|
||||
uhm[key] = val;
|
||||
}
|
||||
|
||||
private:
|
||||
C* m_c;
|
||||
};
|
||||
|
||||
template <typename KeyType, typename ValueType,
|
||||
typename HashFunction, typename Allocator>
|
||||
associative_property_map<CGAL::Unique_hash_map<KeyType, ValueType,
|
||||
HashFunction, Allocator> >
|
||||
make_assoc_property_map(CGAL::Unique_hash_map<KeyType, ValueType,
|
||||
HashFunction, Allocator>& c)
|
||||
{
|
||||
return associative_property_map<CGAL::Unique_hash_map<KeyType, ValueType,
|
||||
HashFunction, Allocator> >(c);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // CGAL_UNIQUE_HASH_MAP_H
|
||||
// EOF
|
||||
|
|
|
|||
Loading…
Reference in New Issue