Skip to content

Commit 6d84578

Browse files
author
Julian LALU
committed
Add array and hashmap copy and move constructor tests
1 parent 441ab34 commit 6d84578

File tree

6 files changed

+12286
-60
lines changed

6 files changed

+12286
-60
lines changed

interface/core/containers/hashmap.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,32 @@ namespace hud
2626
{
2727
}
2828

29-
constexpr explicit(!(hud::is_convertible_v<const hud::pair<key_type, value_type> &, hud::pair<key_type, value_type>>))
30-
slot(const slot &other) noexcept
29+
constexpr explicit(!(hud::is_convertible_v<const hud::pair<key_type, value_type> &, hud::pair<key_type, value_type>>)) slot(const slot &other) noexcept
3130
requires(hud::is_nothrow_copy_constructible_v<hud::pair<key_type, value_type>>)
3231
= default;
3332

3433
template<typename u_key_t = key_t, typename u_value_t = value_t>
3534
requires(hud::is_copy_constructible_v<hud::pair<key_type, value_type>, hud::pair<u_key_t, u_value_t>>)
36-
constexpr explicit(!(hud::is_convertible_v<const hud::pair<key_type, value_type> &, hud::pair<u_key_t, u_value_t>>))
37-
slot(const slot<u_key_t, u_value_t> &other) noexcept
35+
constexpr explicit(!(hud::is_convertible_v<const hud::pair<key_type, value_type> &, hud::pair<u_key_t, u_value_t>>)) slot(const slot<u_key_t, u_value_t> &other) noexcept
3836
: element_(other.element_)
3937
{
4038
static_assert(hud::is_nothrow_copy_constructible_v<key_t, u_key_t>, "key_t(const u_key_t&) copy constructor is throwable. slot is not designed to allow throwable copy constructible components");
4139
static_assert(hud::is_nothrow_copy_constructible_v<value_t, u_value_t>, "value_t(const u_value_t&) copy constructor is throwable. slot is not designed to allow throwable copy constructible components");
4240
}
4341

42+
constexpr explicit(!(hud::is_convertible_v<hud::pair<key_type, value_type>, hud::pair<key_type, value_type>>)) slot(slot &&other) noexcept
43+
requires(hud::is_nothrow_move_constructible_v<hud::pair<key_type, value_type>>)
44+
= default;
45+
46+
template<typename u_key_t = key_t, typename u_value_t = value_t>
47+
requires(hud::is_move_constructible_v<hud::pair<key_type, value_type>, hud::pair<u_key_t, u_value_t>>)
48+
constexpr explicit(!(hud::is_convertible_v<hud::pair<key_type, value_type>, hud::pair<key_type, value_type>>)) slot(slot<u_key_t, u_value_t> &&other) noexcept
49+
: element_(hud::move(other.element_))
50+
{
51+
static_assert(hud::is_nothrow_copy_constructible_v<key_t, u_key_t>, "key_t(const u_key_t&) copy constructor is throwable. slot is not designed to allow throwable copy constructible components");
52+
static_assert(hud::is_nothrow_copy_constructible_v<value_t, u_value_t>, "value_t(const u_value_t&) copy constructor is throwable. slot is not designed to allow throwable copy constructible components");
53+
}
54+
4455
[[nodiscard]] constexpr const key_type &key() noexcept
4556
{
4657
return hud::get<0>(element_);

0 commit comments

Comments
 (0)