| 70 | class IndexSizeT = std::uint32_t, |
| 71 | class GrowthPolicy = tsl::ah::power_of_two_growth_policy<2>> |
| 72 | class array_map { |
| 73 | private: |
| 74 | template <typename U> |
| 75 | using is_iterator = tsl::detail_array_hash::is_iterator<U>; |
| 76 | |
| 77 | using ht = tsl::detail_array_hash::array_hash<CharT, T, Hash, KeyEqual, |
| 78 | StoreNullTerminator, KeySizeT, |
| 79 | IndexSizeT, GrowthPolicy>; |
| 80 | |
| 81 | public: |
| 82 | using char_type = typename ht::char_type; |
| 83 | using mapped_type = T; |
| 84 | using key_size_type = typename ht::key_size_type; |
| 85 | using index_size_type = typename ht::index_size_type; |
| 86 | using size_type = typename ht::size_type; |
| 87 | using hasher = typename ht::hasher; |
| 88 | using key_equal = typename ht::key_equal; |
| 89 | using iterator = typename ht::iterator; |
| 90 | using const_iterator = typename ht::const_iterator; |
| 91 | |
| 92 | public: |
| 93 | array_map() : array_map(ht::DEFAULT_INIT_BUCKET_COUNT) {} |
| 94 | |
| 95 | explicit array_map(size_type bucket_count, const Hash& hash = Hash()) |
| 96 | : m_ht(bucket_count, hash, ht::DEFAULT_MAX_LOAD_FACTOR) {} |
| 97 | |
| 98 | template <class InputIt, typename std::enable_if< |
| 99 | is_iterator<InputIt>::value>::type* = nullptr> |
| 100 | array_map(InputIt first, InputIt last, |
| 101 | size_type bucket_count = ht::DEFAULT_INIT_BUCKET_COUNT, |
| 102 | const Hash& hash = Hash()) |
| 103 | : array_map(bucket_count, hash) { |
| 104 | insert(first, last); |
| 105 | } |
| 106 | |
| 107 | #ifdef TSL_AH_HAS_STRING_VIEW |
| 108 | array_map( |
| 109 | std::initializer_list<std::pair<std::basic_string_view<CharT>, T>> init, |
| 110 | size_type bucket_count = ht::DEFAULT_INIT_BUCKET_COUNT, |
| 111 | const Hash& hash = Hash()) |
| 112 | : array_map(bucket_count, hash) { |
| 113 | insert(init); |
| 114 | } |
| 115 | #else |
| 116 | array_map(std::initializer_list<std::pair<const CharT*, T>> init, |
| 117 | size_type bucket_count = ht::DEFAULT_INIT_BUCKET_COUNT, |
| 118 | const Hash& hash = Hash()) |
| 119 | : array_map(bucket_count, hash) { |
| 120 | insert(init); |
| 121 | } |
| 122 | #endif |
| 123 | |
| 124 | #ifdef TSL_AH_HAS_STRING_VIEW |
| 125 | array_map& operator=( |
| 126 | std::initializer_list<std::pair<std::basic_string_view<CharT>, T>> |
| 127 | ilist) { |
| 128 | clear(); |
| 129 | |