comparison gcc/hash-map-traits.h @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* A hash map traits. 1 /* A hash map traits.
2 Copyright (C) 2015-2017 Free Software Foundation, Inc. 2 Copyright (C) 2015-2018 Free Software Foundation, Inc.
3 3
4 This file is part of GCC. 4 This file is part of GCC.
5 5
6 GCC is free software; you can redistribute it and/or modify it under 6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free 7 the terms of the GNU General Public License as published by the Free
30 30
31 template <typename H, typename Value> 31 template <typename H, typename Value>
32 struct simple_hashmap_traits 32 struct simple_hashmap_traits
33 { 33 {
34 typedef typename H::value_type key_type; 34 typedef typename H::value_type key_type;
35 static const bool maybe_mx = true;
35 static inline hashval_t hash (const key_type &); 36 static inline hashval_t hash (const key_type &);
36 static inline bool equal_keys (const key_type &, const key_type &); 37 static inline bool equal_keys (const key_type &, const key_type &);
37 template <typename T> static inline void remove (T &); 38 template <typename T> static inline void remove (T &);
38 template <typename T> static inline bool is_empty (const T &); 39 template <typename T> static inline bool is_empty (const T &);
39 template <typename T> static inline bool is_deleted (const T &); 40 template <typename T> static inline bool is_deleted (const T &);
94 inline void 95 inline void
95 simple_hashmap_traits <H, Value>::mark_deleted (T &entry) 96 simple_hashmap_traits <H, Value>::mark_deleted (T &entry)
96 { 97 {
97 H::mark_deleted (entry.m_key); 98 H::mark_deleted (entry.m_key);
98 } 99 }
100
101 template <typename H, typename Value>
102 struct simple_cache_map_traits: public simple_hashmap_traits<H,Value>
103 {
104 static const bool maybe_mx = false;
105 };
99 106
100 /* Implement traits for a hash_map with values of type Value for cases 107 /* Implement traits for a hash_map with values of type Value for cases
101 in which the key cannot represent empty and deleted slots. Instead 108 in which the key cannot represent empty and deleted slots. Instead
102 record empty and deleted entries in Value. Derived classes must 109 record empty and deleted entries in Value. Derived classes must
103 implement the hash and equal_keys functions. */ 110 implement the hash and equal_keys functions. */