// Copyright 2016 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_BASE_HASHMAP_ENTRY_H_ #define V8_BASE_HASHMAP_ENTRY_H_ #include <cstdint> #include <type_traits> #include "src/base/memory.h" namespace v8 { namespace base { // Marker type for hashmaps without a value (i.e. hashsets). These won't // allocate space for the value in the entry. struct NoHashMapValue { … }; // HashMap entries are (key, value, hash) triplets, with a boolean indicating if // they are an empty entry. Some clients may not need to use the value slot // (e.g. implementers of sets, where the key is the value), in which case they // should use NoHashMapValue. template <typename Key, typename Value> struct TemplateHashMapEntry { … }; // Specialization for pointer-valued keys TemplateHashMapEntry<Key *, Value>; // Specialization for Address-valued keys TemplateHashMapEntry<Address, Value>; // Specialization for no value. TemplateHashMapEntry<Key, NoHashMapValue>; // Specialization for pointer-valued keys and no value. TemplateHashMapEntry<Key *, NoHashMapValue>; } // namespace base } // namespace v8 #endif // V8_BASE_HASHMAP_ENTRY_H_