// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "hash_map_insert.hpp" #include "hashtable.hpp" #include "select.h" namespace vespalib { template hash_map::hash_map() : _ht(0) { } template hash_map::hash_map(size_t reserveSize) : _ht(reserveSize) { } template hash_map::hash_map(size_t reserveSize, H hasher, EQ equality) : _ht(reserveSize, hasher, equality) { } template hash_map::hash_map(std::initializer_list input) : _ht(0) { insert(input.begin(), input.end()); } template hash_map::~hash_map() noexcept = default; template void hash_map::erase(const K & key) { return _ht.erase(key); } template void hash_map::clear() { _ht.clear(); } template void hash_map::resize(size_t newSize) { _ht.resize(newSize); } template void hash_map::swap(hash_map & rhs) { _ht.swap(rhs._ht); } template size_t hash_map::getMemoryConsumption() const { return _ht.getMemoryConsumption(); } template size_t hash_map::getMemoryUsed() const { return _ht.getMemoryUsed(); } } #define VESPALIB_HASH_MAP_INSTANTIATE_H_E_M(K, V, H, E, M) \ template class vespalib::hash_map; \ template class vespalib::hashtable, H, E, vespalib::Select1st>, M>; \ template vespalib::hashtable, H, E, vespalib::Select1st>, M>::insert_result \ vespalib::hashtable, H, E, vespalib::Select1st>, M>::insert(std::pair &&); \ template vespalib::hashtable, H, E, vespalib::Select1st>, M>::insert_result \ vespalib::hashtable, H, E, vespalib::Select1st>, M>::insert_internal(std::pair &&); #define VESPALIB_HASH_MAP_INSTANTIATE_H_E(K, V, H, E) \ VESPALIB_HASH_MAP_INSTANTIATE_H_E_M(K, V, H, E, vespalib::hashtable_base::prime_modulator) \ VESPALIB_HASH_MAP_INSTANTIATE_H_E_M(K, V, H, E, vespalib::hashtable_base::and_modulator) #define VESPALIB_HASH_MAP_INSTANTIATE_H(K, V, H) VESPALIB_HASH_MAP_INSTANTIATE_H_E(K, V, H, std::equal_to<>) #define VESPALIB_HASH_MAP_INSTANTIATE(K, V) VESPALIB_HASH_MAP_INSTANTIATE_H(K, V, vespalib::hash)