@@ -1310,7 +1310,7 @@ namespace hud
13101310
13111311 auto insert_slot_by_copy = [this ](control_type *control_ptr, auto *slot_ptr)
13121312 {
1313- u64 hash {hasher_type {}(static_cast < const key_type &>( slot_ptr->key ()) )};
1313+ u64 hash {hud::is_same_v<key_type, typename u_storage_t ::key_type> ? hasher_type {}(slot_ptr-> key ()) : hasher_type {}(key_type { slot_ptr->key ()} )};
13141314 // Find H1 slot index
13151315 u64 h1 {H1 (hash)};
13161316 usize slot_index {find_first_empty_or_deleted (control_ptr_, max_slot_count_, h1)};
@@ -1320,34 +1320,6 @@ namespace hud
13201320 hud::memory::construct_object_at (slot_ptr_ + slot_index, *slot_ptr);
13211321 };
13221322 iterate_over_full_slots (other.control_ptr_ , other.slot_ptr_ , count_, other.max_slot_count_ , insert_slot_by_copy);
1323- // auto compute_hash = [](const auto *slot) noexcept
1324- // {
1325- // if constexpr (hud::is_same_v<key_type, typename u_storage_t::key_type>)
1326- // {
1327- // return hasher_type {}(slot->key());
1328- // }
1329- // else
1330- // {
1331- // return hasher_type {}(static_cast<key_type>(slot->key()));
1332- // }
1333- // };
1334- // Skip empty or deleted
1335- // auto [control_full_or_sentinel, slot_full_or_sentinel] = skip_empty_or_deleted(other.control_ptr_, other.slot_ptr_);
1336- // while (control_full_or_sentinel != other.control_ptr_sentinel())
1337- // {
1338- // u64 hash {compute_hash(slot_full_or_sentinel)};
1339- // // Find H1 slot index
1340- // u64 h1 {H1(hash)};
1341- // usize slot_index {find_first_empty_or_deleted(control_ptr_, max_slot_count_, h1)};
1342- // // Save h2 in control h1 index
1343- // control::set_h2(control_ptr_, slot_index, H2(hash), max_slot_count_);
1344- // // Copy slot
1345- // hud::memory::construct_object_at(slot_ptr_ + slot_index, *slot_full_or_sentinel);
1346-
1347- // control_type *full_or_sentinel {control::skip_empty_or_deleted(control_full_or_sentinel + 1)};
1348- // slot_full_or_sentinel += full_or_sentinel - control_full_or_sentinel;
1349- // control_full_or_sentinel = full_or_sentinel;
1350- // }
13511323 }
13521324 }
13531325
0 commit comments