| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #ifndef SRC_VM_HASH_TABLE_H_ | 5 #ifndef SRC_VM_HASH_TABLE_H_ |
| 6 #define SRC_VM_HASH_TABLE_H_ | 6 #define SRC_VM_HASH_TABLE_H_ |
| 7 | 7 |
| 8 #include "src/shared/assert.h" | 8 #include "src/shared/assert.h" |
| 9 #include "src/vm/pair.h" | 9 #include "src/vm/pair.h" |
| 10 #include "src/vm/void_hash_table.h" | 10 #include "src/vm/void_hash_table.h" |
| 11 | 11 |
| 12 namespace fletch { | 12 namespace dartino { |
| 13 | 13 |
| 14 // Used to implement UnorderedMap and UnorderedSet (see hash_map.h and | 14 // Used to implement UnorderedMap and UnorderedSet (see hash_map.h and |
| 15 // hashset.h). Most methods have a very similar interface to | 15 // hashset.h). Most methods have a very similar interface to |
| 16 // std::unordered_set and std::unordered_map. | 16 // std::unordered_set and std::unordered_map. |
| 17 template <typename K, typename V, typename KeyExtractor> | 17 template <typename K, typename V, typename KeyExtractor> |
| 18 class UnorderedHashTable { | 18 class UnorderedHashTable { |
| 19 public: | 19 public: |
| 20 UnorderedHashTable() : map_(sizeof(V)) { ASSERT(sizeof(K) == sizeof(void*)); } | 20 UnorderedHashTable() : map_(sizeof(V)) { ASSERT(sizeof(K) == sizeof(void*)); } |
| 21 | 21 |
| 22 typedef K KeyType; | 22 typedef K KeyType; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 147 } |
| 148 | 148 |
| 149 inline Iterator End() { return Iterator(map_, map_.backing_end()); } | 149 inline Iterator End() { return Iterator(map_, map_.backing_end()); } |
| 150 | 150 |
| 151 inline void Clear() { map_.Clear(); } | 151 inline void Clear() { map_.Clear(); } |
| 152 | 152 |
| 153 protected: | 153 protected: |
| 154 VoidHashTable map_; | 154 VoidHashTable map_; |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 } // namespace fletch | 157 } // namespace dartino |
| 158 | 158 |
| 159 #endif // SRC_VM_HASH_TABLE_H_ | 159 #endif // SRC_VM_HASH_TABLE_H_ |
| OLD | NEW |