4 * Copyright (c) 2017 Tessil 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 * copies of the Software, and to permit persons to whom the Software is 11 * furnished to do so, subject to the following conditions: 13 * The above copyright notice and this permission notice shall be included in all 14 * copies or substantial portions of the Software. 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 #ifndefTSL_ARRAY_MAP_H 25 #defineTSL_ARRAY_MAP_H 29 #include<initializer_list> 40 * Implementation of a cache-conscious string hash map. 42 * The map stores the strings as `const CharT*`. If `StoreNullTerminator` is true, 43 * the strings are stored with the a null-terminator (the `key()` method of the iterators 44 * will return a pointer to this null-terminated string). Otherwise the null character 45 * is not stored (which allow an economy of 1 byte per string). 47 * The value `T` must be either nothrow move-constructible, copy-constuctible or both. 49 * The size of a key string is limited to `std::numeric_limits<KeySizeT>::max() - 1`. 50 * That is 65 535 characters by default, but can be raised with the `KeySizeT` template parameter. 51 * See `max_key_size()` for an easy access to this limit. 53 * The number of elements in the map is limited to `std::numeric_limits<IndexSizeT>::max()`. 54 * That is 4 294 967 296 elements, but can be raised with the `IndexSizeT` template parameter. 55 * See `max_size()` for an easy access to this limit. 57 * Iterators invalidation: 58 * - clear, operator=: always invalidate the iterators. 59 * - insert, emplace, operator[]: always invalidate the iterators. 60 * - erase: always invalidate the iterators. 61 * - shrink_to_fit: always invalidate the iterators. 67 bool StoreNullTerminator =
true,
68 class KeySizeT = std::uint16_t,
69 class IndexSizeT = std::uint32_t,
77 KeySizeT, IndexSizeT, GrowthPolicy>;
80 using char_type =
typename ht::char_type;
81 using mapped_type = T;
82 using key_size_type =
typename ht::key_size_type;
83 using index_size_type =
typename ht::index_size_type;
84 using size_type =
typename ht::size_type;
85 using hasher =
typename ht::hasher;
86 using key_equal =
typename ht::key_equal;
87 using iterator =
typename ht::iterator;
88 using const_iterator =
typename ht::const_iterator;
95 const Hash& hash = Hash()): m_ht(bucket_count, hash, ht::DEFAULT_MAX_LOAD_FACTOR)
99 template<
class InputIt,
typename std::enable_if<is_iterator<InputIt>::value>::type* =
nullptr>
101 size_type bucket_count = ht::DEFAULT_INIT_BUCKET_COUNT,
102 const Hash& hash = Hash()):
array_map(bucket_count, hash)
109 #ifdefTSL_AH_HAS_STRING_VIEW 117 array_map(std::initializer_list<std::pair<
const CharT*, T>> init,
118 size_type bucket_count = ht::DEFAULT_INIT_BUCKET_COUNT,
119 const Hash& hash = Hash()):
array_map(bucket_count, hash)
127 #ifdefTSL_AH_HAS_STRING_VIEW 137 array_map& operator=(std::initializer_list<std::pair<
const CharT*, T>> ilist) {
152 iterator
begin()
noexcept {
return m_ht.begin(); }
153 const_iterator
begin()
constnoexcept {
return m_ht.begin(); }
154 const_iterator
cbegin()
constnoexcept {
return m_ht.cbegin(); }
156 iterator
end()
noexcept {
return m_ht.end(); }
157 const_iterator
end()
constnoexcept {
return m_ht.end(); }
158 const_iterator
cend()
constnoexcept {
return m_ht.cend(); }
165 boolempty()
constnoexcept {
return m_ht.empty(); }
166 size_type
size()
constnoexcept {
return m_ht.size(); }
167 size_type
max_size()
constnoexcept {
return m_ht.max_size(); }
176 voidclear()
noexcept { m_ht.clear(); }
180 #ifdefTSL_AH_HAS_STRING_VIEW 185 std::pair<iterator,
bool> insert(
const CharT* key,
const T& value) {
186 return m_ht.emplace(key, std::char_traits<CharT>::length(key), value);
189 std::pair<iterator,
bool> insert(
const std::basic_string<CharT>& key,
const T& value) {
190 return m_ht.emplace(key.data(), key.size(), value);
193 std::pair<iterator,
bool>
insert_ks(
const CharT* key, size_type key_size,
const T& value) {
194 return m_ht.emplace(key, key_size, value);
199 #ifdefTSL_AH_HAS_STRING_VIEW 204 std::pair<iterator,
bool> insert(
const CharT* key, T&& value) {
205 return m_ht.emplace(key, std::char_traits<CharT>::length(key), std::move(value));
208 std::pair<iterator,
bool> insert(
const std::basic_string<CharT>& key, T&& value) {
209 return m_ht.emplace(key.data(), key.size(), std::move(value));
212 std::pair<iterator,
bool>
insert_ks(
const CharT* key, size_type key_size, T&& value) {
213 return m_ht.emplace(key, key_size, std::move(value));
218 template<
class InputIt,
typename std::enable_if<is_iterator<InputIt>::value>::type* =
nullptr>
219 voidinsert(InputIt first, InputIt last) {
220 if(std::is_base_of<std::forward_iterator_tag,
221 typename std::iterator_traits<InputIt>::iterator_category>::value)
223 constauto nb_elements_insert = std::distance(first, last);
224 const std::size_t nb_free_buckets = std::size_t(
float(
bucket_count())*max_load_factor()) -
size();
226 if(nb_elements_insert > 0 && nb_free_buckets < std::size_t(nb_elements_insert)) {
231 for(
auto it = first; it != last; ++it) {
238 #ifdefTSL_AH_HAS_STRING_VIEW 243 void insert(std::initializer_list<std::pair<
const CharT*, T>> ilist) {
244 insert(ilist.begin(), ilist.end());
250 #ifdefTSL_AH_HAS_STRING_VIEW 257 std::pair<iterator,
bool> insert_or_assign(
const CharT* key, M&& obj) {
258 return m_ht.insert_or_assign(key, std::char_traits<CharT>::length(key), std::forward<M>(obj));
262 std::pair<iterator,
bool> insert_or_assign(
const std::basic_string<CharT>& key, M&& obj) {
263 return m_ht.insert_or_assign(key.data(), key.size(), std::forward<M>(obj));
268 return m_ht.insert_or_assign(key, key_size, std::forward<M>(obj));
273 #ifdefTSL_AH_HAS_STRING_VIEW 274 template<
class...
Args>
279 template<
class... Args>
280 std::pair<iterator,
bool> emplace(
const CharT* key, Args&&... args) {
281 return m_ht.emplace(key, std::char_traits<CharT>::length(key), std::forward<Args>(args)...);
284 template<
class... Args>
285 std::pair<iterator,
bool> emplace(
const std::basic_string<CharT>& key, Args&&... args) {
286 return m_ht.emplace(key.data(), key.size(), std::forward<Args>(args)...);
289 template<
class... Args>
290 std::pair<iterator,
bool>
emplace_ks(
const CharT* key, size_type key_size, Args&&... args) {
291 return m_ht.emplace(key, key_size, std::forward<Args>(args)...);
297 * Erase has an amortized O(1) runtime complexity, but even if it removes the key immediatly, 298 * it doesn't do the same for the associated value T. 300 * T will only be removed when the ratio between the size of the map and 301 * the size of the map + the number of deleted values still stored is low enough. 303 * To force the deletion you can call shrink_to_fit. 305 iterator
erase(const_iterator pos) {
return m_ht.erase(pos); }
308 * @copydoc erase(const_iterator pos) 310 iterator
erase(const_iterator first, const_iterator last) {
return m_ht.erase(first, last); }
314 #ifdefTSL_AH_HAS_STRING_VIEW 316 * @copydoc erase(const_iterator pos) 323 * @copydoc erase(const_iterator pos) 325 size_type erase(
const CharT* key) {
326 return m_ht.erase(key, std::char_traits<CharT>::length(key));
330 * @copydoc erase(const_iterator pos) 332 size_type erase(
const std::basic_string<CharT>& key) {
333 return m_ht.erase(key.data(), key.size());
337 * @copydoc erase(const_iterator pos) 339 size_type
erase_ks(
const CharT* key, size_type key_size) {
340 return m_ht.erase(key, key_size);
345 #ifdefTSL_AH_HAS_STRING_VIEW 347 * @copydoc erase_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 354 * @copydoc erase_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 356 size_type erase(
const CharT* key, std::size_t precalculated_hash) {
357 return m_ht.erase(key, std::char_traits<CharT>::length(key), precalculated_hash);
361 * @copydoc erase_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 363 size_type erase(
const std::basic_string<CharT>& key, std::size_t precalculated_hash) {
364 return m_ht.erase(key.data(), key.size(), precalculated_hash);
368 * @copydoc erase(const_iterator pos) 370 * Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same 371 * as hash_function()(key). Usefull to speed-up the lookup to the value if you already have the hash. 373 size_type
erase_ks(
const CharT* key, size_type key_size, std::size_t precalculated_hash) {
374 return m_ht.erase(key, key_size, precalculated_hash);
386 #ifdefTSL_AH_HAS_STRING_VIEW 395 T& at(
const CharT* key) {
396 return m_ht.at(key, std::char_traits<CharT>::length(key));
399 const T& at(
const CharT* key)
const {
400 return m_ht.at(key, std::char_traits<CharT>::length(key));
403 T& at(
const std::basic_string<CharT>& key) {
404 return m_ht.at(key.data(), key.size());
407 const T& at(
const std::basic_string<CharT>& key)
const {
408 return m_ht.at(key.data(), key.size());
411 T&
at_ks(
const CharT* key, size_type key_size) {
412 return m_ht.at(key, key_size);
415 const T&
at_ks(
const CharT* key, size_type key_size)
const {
416 return m_ht.at(key, key_size);
421 #ifdefTSL_AH_HAS_STRING_VIEW 423 * @copydoc at_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 430 * @copydoc at_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 437 * @copydoc at_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 439 T& at(
const CharT* key, std::size_t precalculated_hash) {
440 return m_ht.at(key, std::char_traits<CharT>::length(key), precalculated_hash);
444 * @copydoc at_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 446 const T& at(
const CharT* key, std::size_t precalculated_hash)
const {
447 return m_ht.at(key, std::char_traits<CharT>::length(key), precalculated_hash);
451 * @copydoc at_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 453 T& at(
const std::basic_string<CharT>& key, std::size_t precalculated_hash) {
454 return m_ht.at(key.data(), key.size(), precalculated_hash);
458 * @copydoc at_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 460 const T& at(
const std::basic_string<CharT>& key, std::size_t precalculated_hash)
const {
461 return m_ht.at(key.data(), key.size(), precalculated_hash);
465 * Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same 466 * as hash_function()(key). Usefull to speed-up the lookup to the value if you already have the hash. 468 T&
at_ks(
const CharT* key, size_type key_size, std::size_t precalculated_hash) {
469 return m_ht.at(key, key_size, precalculated_hash);
473 * @copydoc at_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 475 const T&
at_ks(
const CharT* key, size_type key_size, std::size_t precalculated_hash)
const {
476 return m_ht.at(key, key_size, precalculated_hash);
481 #ifdefTSL_AH_HAS_STRING_VIEW 484 T& operator[](
const CharT* key) {
return m_ht.access_operator(key, std::char_traits<CharT>::length(key)); }
485 T& operator[](
const std::basic_string<CharT>& key) {
return m_ht.access_operator(key.data(), key.size()); }
490 #ifdefTSL_AH_HAS_STRING_VIEW 495 size_type count(
const CharT* key)
const {
496 return m_ht.count(key, std::char_traits<CharT>::length(key));
499 size_type count(
const std::basic_string<CharT>& key)
const {
500 return m_ht.count(key.data(), key.size());
503 size_type
count_ks(
const CharT* key, size_type key_size)
const {
504 return m_ht.count(key, key_size);
509 #ifdefTSL_AH_HAS_STRING_VIEW 511 * @copydoc count_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) const 518 * @copydoc count_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) const 520 size_type count(
const CharT* key, std::size_t precalculated_hash)
const {
521 return m_ht.count(key, std::char_traits<CharT>::length(key), precalculated_hash);
525 * @copydoc count_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) const 527 size_type count(
const std::basic_string<CharT>& key, std::size_t precalculated_hash)
const {
528 return m_ht.count(key.data(), key.size(), precalculated_hash);
532 * Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same 533 * as hash_function()(key). Usefull to speed-up the lookup to the value if you already have the hash. 535 size_type
count_ks(
const CharT* key, size_type key_size, std::size_t precalculated_hash)
const {
536 return m_ht.count(key, key_size, precalculated_hash);
541 #ifdefTSL_AH_HAS_STRING_VIEW 550 iterator find(
const CharT* key) {
551 return m_ht.find(key, std::char_traits<CharT>::length(key));
554 const_iterator find(
const CharT* key)
const {
555 return m_ht.find(key, std::char_traits<CharT>::length(key));
558 iterator find(
const std::basic_string<CharT>& key) {
559 return m_ht.find(key.data(), key.size());
562 const_iterator find(
const std::basic_string<CharT>& key)
const {
563 return m_ht.find(key.data(), key.size());
566 iterator
find_ks(
const CharT* key, size_type key_size) {
567 return m_ht.find(key, key_size);
570 const_iterator
find_ks(
const CharT* key, size_type key_size)
const {
571 return m_ht.find(key, key_size);
576 #ifdefTSL_AH_HAS_STRING_VIEW 578 * @copydoc find_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 585 * @copydoc find_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 592 * @copydoc find_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 594 iterator find(
const CharT* key, std::size_t precalculated_hash) {
595 return m_ht.find(key, std::char_traits<CharT>::length(key), precalculated_hash);
599 * @copydoc find_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 601 const_iterator find(
const CharT* key, std::size_t precalculated_hash)
const {
602 return m_ht.find(key, std::char_traits<CharT>::length(key), precalculated_hash);
606 * @copydoc find_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 608 iterator find(
const std::basic_string<CharT>& key, std::size_t precalculated_hash) {
609 return m_ht.find(key.data(), key.size(), precalculated_hash);
613 * @copydoc find_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 615 const_iterator find(
const std::basic_string<CharT>& key, std::size_t precalculated_hash)
const {
616 return m_ht.find(key.data(), key.size(), precalculated_hash);
620 * Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same 621 * as hash_function()(key). Usefull to speed-up the lookup to the value if you already have the hash. 623 iterator
find_ks(
const CharT* key, size_type key_size, std::size_t precalculated_hash) {
624 return m_ht.find(key, key_size, precalculated_hash);
628 * @copydoc find_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 630 const_iterator
find_ks(
const CharT* key, size_type key_size, std::size_t precalculated_hash)
const {
631 return m_ht.find(key, key_size, precalculated_hash);
636 #ifdefTSL_AH_HAS_STRING_VIEW 645 std::pair<iterator, iterator> equal_range(
const CharT* key) {
646 return m_ht.equal_range(key, std::char_traits<CharT>::length(key));
649 std::pair<const_iterator, const_iterator> equal_range(
const CharT* key)
const {
650 return m_ht.equal_range(key, std::char_traits<CharT>::length(key));
653 std::pair<iterator, iterator> equal_range(
const std::basic_string<CharT>& key) {
654 return m_ht.equal_range(key.data(), key.size());
657 std::pair<const_iterator, const_iterator> equal_range(
const std::basic_string<CharT>& key)
const {
658 return m_ht.equal_range(key.data(), key.size());
661 std::pair<iterator, iterator>
equal_range_ks(
const CharT* key, size_type key_size) {
662 return m_ht.equal_range(key, key_size);
665 std::pair<const_iterator, const_iterator>
equal_range_ks(
const CharT* key, size_type key_size)
const {
666 return m_ht.equal_range(key, key_size);
671 #ifdefTSL_AH_HAS_STRING_VIEW 673 * @copydoc equal_range_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 680 * @copydoc equal_range_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 687 * @copydoc equal_range_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 689 std::pair<iterator, iterator> equal_range(
const CharT* key, std::size_t precalculated_hash) {
690 return m_ht.equal_range(key, std::char_traits<CharT>::length(key), precalculated_hash);
694 * @copydoc equal_range_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 696 std::pair<const_iterator, const_iterator> equal_range(
const CharT* key, std::size_t precalculated_hash)
const {
697 return m_ht.equal_range(key, std::char_traits<CharT>::length(key), precalculated_hash);
701 * @copydoc equal_range_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 703 std::pair<iterator, iterator> equal_range(
const std::basic_string<CharT>& key, std::size_t precalculated_hash) {
704 return m_ht.equal_range(key.data(), key.size(), precalculated_hash);
708 * @copydoc equal_range_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 710 std::pair<const_iterator, const_iterator> equal_range(
const std::basic_string<CharT>& key, std::size_t precalculated_hash)
const {
711 return m_ht.equal_range(key.data(), key.size(), precalculated_hash);
715 * Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same 716 * as hash_function()(key). Usefull to speed-up the lookup to the value if you already have the hash. 718 std::pair<iterator, iterator>
equal_range_ks(
const CharT* key, size_type key_size, std::size_t precalculated_hash) {
719 return m_ht.equal_range(key, key_size, precalculated_hash);
723 * @copydoc equal_range_ks(const CharT* key, size_type key_size, std::size_t precalculated_hash) 725 std::pair<const_iterator, const_iterator>
equal_range_ks(
const CharT* key, size_type key_size, std::size_t precalculated_hash)
const {
726 return m_ht.equal_range(key, key_size, precalculated_hash);
745 voidrehash(size_type count) { m_ht.rehash(count); }
746 voidreserve(size_type count) { m_ht.reserve(count); }
753 key_equal
key_eq()
const {
return m_ht.key_eq(); }
760 * Return the `const_iterator it` as an `iterator`. 765 * Serialize the map through the `serializer` parameter. 767 * The `serializer` parameter must be a function object that supports the following calls: 768 * - `void operator()(const U& value);` where the types `std::uint64_t`, `float` and `T` must be supported for U. 769 * - `void operator()(const CharT* value, std::size_t value_size);` 771 * The implementation leaves binary compatibilty (endianness, IEEE 754 for floats, ...) of the types it serializes 772 * in the hands of the `Serializer` function object if compatibilty is required. 774 template<
class Serializer>
776 m_ht.serialize(serializer);
780 * Deserialize a previouly serialized map through the `deserializer` parameter. 782 * The `deserializer` parameter must be a function object that supports the following calls: 783 * - `template<typename U> U operator()();` where the types `std::uint64_t`, `float` and `T` must be supported for U. 784 * - `void operator()(CharT* value_out, std::size_t value_size);` 786 * If the deserialized hash map type is hash compatible with the serialized map, the deserialization process can be 787 * sped up by setting `hash_compatible` to true. To be hash compatible, the Hash (take care of the 32-bits vs 64 bits), 788 * KeyEqual, GrowthPolicy, StoreNullTerminator, KeySizeT and IndexSizeT must behave the same than the one used on the 789 * serialazed map. Otherwise the behaviour is undefined with `hash_compatible` sets to true, . 791 * The behaviour is undefined if the type `CharT` and `T` of the `array_map` are not the same as the 792 * types used during serialization. 794 * The implementation leaves binary compatibilty (endianness, IEEE 754 for floats, ...) of the types it deserializes 795 * in the hands of the `Deserializer` function object if compatibilty is required. 797 template<
class Deserializer>
800 map.m_ht.deserialize(deserializer, hash_compatible);
806 if(lhs.size() != rhs.size()) {
810 for(
auto it = lhs.cbegin(); it != lhs.cend(); ++it) {
811 constauto it_element_rhs = rhs.find_ks(it.key(), it.key_size());
812 if(it_element_rhs == rhs.cend() || it.value() != it_element_rhs.value()) {
821 return !operator==(lhs, rhs);
829 template<
class U,
class V>
830 void insert_pair(
const std::pair<U, V>& value) {
831 insert(value.first, value.second);
834 template<
class U,
class V>
835 void insert_pair(std::pair<U, V>&& value) {
836 insert(value.first, std::move(value.second));
849 * `tsl::array_map<CharT, T, Hash, KeyEqual, StoreNullTerminator, KeySizeT, IndexSizeT, tsl::ah::prime_growth_policy>`. 851 template<
class CharT,
855 bool StoreNullTerminator =
true,
856 class KeySizeT = std::uint16_t,
857 class IndexSizeT = std::uint32_t>
858 using array_pg_map =
array_map<CharT, T, Hash, KeyEqual, StoreNullTerminator,
size_type erase_ks(const CharT *key, size_type key_size, std::size_t precalculated_hash)
Definition: array_map.h:373
std::pair< iterator, bool > insert_ks(const CharT *key, size_type key_size, const T &value)
Definition: array_map.h:193
Definition: array_growth_policy.h:40
array_map(size_type bucket_count, const Hash &hash=Hash())
Definition: array_map.h:94
static const size_type MAX_KEY_SIZE
Definition: array_map.h:840
void swap(array_map &other)
Definition: array_map.h:379
Definition: array_growth_policy.h:39
std::pair< const_iterator, const_iterator > equal_range_ks(const CharT *key, size_type key_size) const
Definition: array_map.h:665
size_type count_ks(const CharT *key, size_type key_size, std::size_t precalculated_hash) const
Definition: array_map.h:535
float load_factor() const
Definition: array_map.h:741
void clear() noexcept
Definition: array_map.h:176
Definition: array_hash.h:117
size_type max_bucket_count() const
Definition: array_map.h:735
std::pair< iterator, bool > emplace_ks(const CharT *key, size_type key_size, Args &&... args)
Definition: array_map.h:290
size_type size() const noexcept
Definition: array_map.h:166
size_type max_size() const noexcept
Definition: array_map.h:167
void reserve(size_type count)
Definition: array_map.h:746
iterator end() noexcept
Definition: array_map.h:156
size_type bucket_count() const
Definition: array_map.h:734
Definition: array_hash.h:102
hasher hash_function() const
Definition: array_map.h:752
friend void swap(array_map &lhs, array_map &rhs)
Definition: array_map.h:824
iterator find_ks(const CharT *key, size_type key_size)
Definition: array_map.h:566
iterator mutable_iterator(const_iterator it) noexcept
Definition: array_map.h:762
static array_map deserialize(Deserializer &deserializer, bool hash_compatible=false)
Definition: array_map.h:798
iterator erase(const_iterator pos)
Definition: array_map.h:305
std::pair< const_iterator, const_iterator > equal_range_ks(const CharT *key, size_type key_size, std::size_t precalculated_hash) const
Definition: array_map.h:725
iterator find_ks(const CharT *key, size_type key_size, std::size_t precalculated_hash)
Definition: array_map.h:623
T & at_ks(const CharT *key, size_type key_size, std::size_t precalculated_hash)
Definition: array_map.h:468
void rehash(size_type count)
Definition: array_map.h:745
const T & at_ks(const CharT *key, size_type key_size, std::size_t precalculated_hash) const
Definition: array_map.h:475
void max_load_factor(float ml)
Definition: array_map.h:743
void insert(InputIt first, InputIt last)
Definition: array_map.h:219
const_iterator cend() const noexcept
Definition: array_map.h:158
std::pair< iterator, iterator > equal_range_ks(const CharT *key, size_type key_size, std::size_t precalculated_hash)
Definition: array_map.h:718
array_map(InputIt first, InputIt last, size_type bucket_count=ht::DEFAULT_INIT_BUCKET_COUNT, const Hash &hash=Hash())
Definition: array_map.h:100
const_iterator cbegin() const noexcept
Definition: array_map.h:154
size_type erase_ks(const CharT *key, size_type key_size)
Definition: array_map.h:339
friend bool operator!=(const array_map &lhs, const array_map &rhs)
Definition: array_map.h:820
friend bool operator==(const array_map &lhs, const array_map &rhs)
Definition: array_map.h:805
T & at_ks(const CharT *key, size_type key_size)
Definition: array_map.h:411
std::size_t operator()(const CharT *key, std::size_t key_size) const
Definition: array_hash.h:79
Definition: array_growth_policy.h:49
Definition: array_growth_policy.h:247
key_equal key_eq() const
Definition: array_map.h:753
const_iterator end() const noexcept
Definition: array_map.h:157
float max_load_factor() const
Definition: array_map.h:742
size_type count_ks(const CharT *key, size_type key_size) const
Definition: array_map.h:503
array_map()
Definition: array_map.h:91
iterator erase(const_iterator first, const_iterator last)
Definition: array_map.h:310
std::pair< iterator, bool > insert_ks(const CharT *key, size_type key_size, T &&value)
Definition: array_map.h:212
void serialize(Serializer &serializer) const
Definition: array_map.h:775
bool empty() const noexcept
Definition: array_map.h:165
Definition: array_hash.h:742
const T & at_ks(const CharT *key, size_type key_size) const
Definition: array_map.h:415
std::pair< iterator, iterator > equal_range_ks(const CharT *key, size_type key_size)
Definition: array_map.h:661
const_iterator find_ks(const CharT *key, size_type key_size) const
Definition: array_map.h:570
const_iterator begin() const noexcept
Definition: array_map.h:153
std::pair< iterator, bool > insert_or_assign_ks(const CharT *key, size_type key_size, M &&obj)
Definition: array_map.h:267
const_iterator find_ks(const CharT *key, size_type key_size, std::size_t precalculated_hash) const
Definition: array_map.h:630
std::pair< const_iterator, const_iterator > equal_range(const std::basic_string_view< CharT > &key, std::size_t precalculated_hash) const
Definition: array_map.h:682
void shrink_to_fit()
Definition: array_map.h:169
iterator begin() noexcept
Definition: array_map.h:152
size_type max_key_size() const noexcept
Definition: array_map.h:168