15 template<ice::concepts::AssociativeContainerType T>
21 typename std::remove_reference_t<T>::EntryType;
22 { std::remove_reference_t<T>::OperationLogic } -> std::convertible_to<ice::ContainerLogic>;
23 { t._capacity } -> std::convertible_to<ice::u32>;
24 { t._count } -> std::convertible_to<ice::u32>;
25 { t._hashes } -> std::convertible_to<ice::u32 const*>;
26 { t._entries } -> std::convertible_to<ice::detail::hashmap::HashMapEntryType<T>*>;
27 { t._data } -> std::convertible_to<ice::container::ValuePtr<T>>;
52 template<
typename EntryType,
typename ValueType>
63 template<ice::detail::hashmap::HashMapContainer ContainerT>
66 return ice::Span{ map._entries, map._count };
69 template<ice::detail::hashmap::HashMapContainer ContainerT>
83 fr.
hash_i = key % map._capacity;
88 if (map._entries[fr.
entry_i].key == key)
99 template<ice::detail::hashmap::HashMapContainer ContainerT>
105 fr.
hash_i = key % map._capacity;
112 map._entries[index].key = key;
115 map._entries[index].next = map._hashes[fr.
hash_i];
118 map._hashes[fr.
hash_i] = index;
126 template<ice::detail::hashmap::HashMapContainer ContainerT>
129 using Entry =
typename ContainerT::EntryType;
130 using Type =
typename ContainerT::ValueType;
135 map._hashes[fr.hash_i] = map._entries[fr.entry_i].next;
139 map._entries[fr.entry_prev].next = map._entries[fr.entry_i].next;
149 if (fr.entry_i == map._count)
159 .location = map._data + fr.entry_i,
163 ice::move(map._data[map._count])
171 map._data[fr.entry_i] = map._data[map._count];
175 map._entries[fr.entry_i] = map._entries[map._count];
182 map._hashes[last_key_first_entry.
hash_i] = fr.entry_i;
186 Entry* prev_entry = map._entries + last_key_first_entry.
entry_prev;
189 while (prev_entry->next != map._count)
192 prev_entry = map._entries + prev_entry->next;
196 prev_entry->next = fr.entry_i;
200 template<ice::detail::hashmap::HashMapContainer ContainerT>
206 template<ice::detail::hashmap::HashMapContainer ContainerT>
220 fr.
hash_i = key % map._capacity;
227 map._entries[index].key = key;
230 map._entries[index].next = map._hashes[fr.
hash_i];
233 map._hashes[fr.
hash_i] = index;
241 template<ice::detail::hashmap::HashMapContainer ContainerT>
252 template<ice::detail::hashmap::HashMapContainer ContainerT>
268 fr.
hash_i = entry->key % map._capacity;
273 if ((map._entries + fr.
entry_i) == entry)
#define ICE_ASSERT_CORE(expression)
Definition assert_core.hxx:43
Definition container_concepts.hxx:22
A concept used to enable access to read-only operations for all compatible types.
Definition hashmap_details.hxx:20
typename std::remove_reference_t< ContainerT >::KeyType KeyType
Definition container_concepts.hxx:135
Definition hashmap_details.hxx:13
constexpr auto calc_meminfo(ice::ncount capacity) noexcept -> ice::meminfo
Definition hashmap_details.hxx:53
auto find(ContainerT const &map, ice::u64 key) noexcept -> FindResult
Definition hashmap_details.hxx:70
auto make(ContainerT &map, ice::u64 key) noexcept -> ice::u32
Definition hashmap_details.hxx:100
constexpr auto calc_required_capacity(ice::ncount max_count) noexcept -> ice::ncount
Definition hashmap_details.hxx:40
bool find_and_erase(ContainerT &map, ice::u64 key) noexcept
Definition hashmap_details.hxx:242
constexpr auto capacity_with_overhead(ice::ncount max_count) noexcept -> ice::ncount
Definition hashmap_details.hxx:47
auto find_or_make(ContainerT &map, ice::u64 key, bool &found) noexcept -> ice::u32
Definition hashmap_details.hxx:207
static constexpr ice::f32 Constant_HashMapMaxFill
Definition hashmap_details.hxx:30
void erase(ContainerT &map, FindResult const fr) noexcept
Definition hashmap_details.hxx:127
auto entries(ContainerT const &map) noexcept -> ice::Span< typename ContainerT::EntryType const >
Definition hashmap_details.hxx:64
auto find_or_fail(ContainerT const &map, ice::container::KeyType< ContainerT > key) noexcept -> ice::u32
Definition hashmap_details.hxx:201
static constexpr ice::u32 Constant_EndOfList
Definition hashmap_details.hxx:31
ice::const_correct_t< T, typename std::remove_reference_t< T >::EntryType > HashMapEntryType
Definition hashmap_details.hxx:16
SPDX-License-Identifier: MIT.
Definition array.hxx:12
constexpr ice::usize size_of
Definition mem_info.hxx:12
auto mem_move_construct_at(void *memory_ptr, T &&other) noexcept -> T *
Definition mem_initializers.hxx:26
@ Complex
The collection handles complex data types and properly implements copy and move semantics.
Definition container_logic.hxx:19
std::uint64_t u64
Definition types.hxx:27
constexpr ice::ualign align_of
Definition mem_info.hxx:15
typename ice::const_correct< OwnerT, ValueT >::type const_correct_t
Definition utility.hxx:24
std::uint32_t u32
Definition types.hxx:26
void mem_destruct_at(T *location) noexcept
Definition mem_initializers.hxx:107
constexpr ice::meminfo meminfo_of
Definition mem_info.hxx:18
float f32
Definition types.hxx:16
Definition mem_memory.hxx:13
A view into an array of objects laid out in contiguous memory.
Definition span.hxx:17
Definition hashmap_details.hxx:34
ice::u32 entry_i
Definition hashmap_details.hxx:37
ice::u32 entry_prev
Definition hashmap_details.hxx:36
ice::u32 hash_i
Definition hashmap_details.hxx:35
Definition mem_size_types.hxx:59
ice::detail::nvalue_base_utype base_type
Definition nvalue.hxx:75