Skip to content

Commit c67ad8b

Browse files
author
Julian LALU
committed
Improve hashmap
1 parent aa25806 commit c67ad8b

3 files changed

Lines changed: 710 additions & 6 deletions

File tree

interface/core/containers/hashset.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ namespace hud
873873
}
874874

875875
template<typename u_storage_t, typename u_hasher_t, typename u_key_equal_t, typename u_allocator_t>
876-
requires(hud::is_copy_constructible_v<slot_type>)
876+
requires(hud::is_copy_constructible_v<slot_type, typename hashset_impl<u_storage_t, u_hasher_t, u_key_equal_t, u_allocator_t>::slot_type>)
877877
constexpr hashset_impl &operator=(const hashset_impl<u_storage_t, u_hasher_t, u_key_equal_t, u_allocator_t> &other) noexcept
878878
{
879879
copy_assign(other);
@@ -891,16 +891,16 @@ namespace hud
891891
{
892892
if (this != &other)
893893
{
894-
move_assign(other);
894+
move_assign(hud::move(other));
895895
}
896896
return *this;
897897
}
898898

899899
template<typename u_storage_t, typename u_hasher_t, typename u_key_equal_t, typename u_allocator_t>
900-
requires(hud::is_move_constructible_v<slot_type>)
900+
requires(hud::is_move_constructible_v<slot_type, typename hashset_impl<u_storage_t, u_hasher_t, u_key_equal_t, u_allocator_t>::slot_type>)
901901
constexpr hashset_impl &operator=(hashset_impl<u_storage_t, u_hasher_t, u_key_equal_t, u_allocator_t> &&other) noexcept
902902
{
903-
move_assign(other);
903+
move_assign(hud::forward<hashset_impl<u_storage_t, u_hasher_t, u_key_equal_t, u_allocator_t>>(other));
904904
return *this;
905905
}
906906

@@ -1475,8 +1475,7 @@ namespace hud
14751475
}
14761476
}
14771477

1478-
[[nodiscard]] constexpr usize
1479-
free_slot_before_grow() const noexcept
1478+
[[nodiscard]] constexpr usize free_slot_before_grow() const noexcept
14801479
{
14811480
return free_slot_before_grow_;
14821481
}

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ set( src
7575
hashmap/hashmap_contains.cpp
7676
hashmap/hashmap_iterator.cpp
7777
hashmap/hashmap_misc.cpp
78+
hashmap/hashmap_move_assign_operator.cpp
7879
hashmap/hashmap_move_constructors.cpp
7980
hashset/hashset_add.cpp
8081
hashset/hashset_constructors.cpp

0 commit comments

Comments
 (0)