diff --git a/include/tl/expected.hpp b/include/tl/expected.hpp index 5bc17a1..3c22c5c 100644 --- a/include/tl/expected.hpp +++ b/include/tl/expected.hpp @@ -528,6 +528,10 @@ template struct expected_storage_base { Args &&...args) : m_unexpect(il, std::forward(args)...), m_has_val(false) {} + expected_storage_base(const expected_storage_base &) = default; + expected_storage_base(expected_storage_base &&) = default; + expected_storage_base &operator=(const expected_storage_base &) = default; + expected_storage_base &operator=(expected_storage_base &&) = default; ~expected_storage_base() = default; union { T m_val; @@ -569,6 +573,10 @@ template struct expected_storage_base { Args &&...args) : m_unexpect(il, std::forward(args)...), m_has_val(false) {} + expected_storage_base(const expected_storage_base &) = default; + expected_storage_base(expected_storage_base &&) = default; + expected_storage_base &operator=(const expected_storage_base &) = default; + expected_storage_base &operator=(expected_storage_base &&) = default; ~expected_storage_base() { if (!m_has_val) { m_unexpect.~unexpected(); @@ -614,6 +622,10 @@ template struct expected_storage_base { Args &&...args) : m_unexpect(il, std::forward(args)...), m_has_val(false) {} + expected_storage_base(const expected_storage_base &) = default; + expected_storage_base(expected_storage_base &&) = default; + expected_storage_base &operator=(const expected_storage_base &) = default; + expected_storage_base &operator=(expected_storage_base &&) = default; ~expected_storage_base() { if (m_has_val) { m_val.~T(); @@ -654,6 +666,10 @@ template struct expected_storage_base { Args &&...args) : m_unexpect(il, std::forward(args)...), m_has_val(false) {} + expected_storage_base(const expected_storage_base &) = default; + expected_storage_base(expected_storage_base &&) = default; + expected_storage_base &operator=(const expected_storage_base &) = default; + expected_storage_base &operator=(expected_storage_base &&) = default; ~expected_storage_base() = default; struct dummy {}; union { @@ -684,6 +700,10 @@ template struct expected_storage_base { Args &&...args) : m_unexpect(il, std::forward(args)...), m_has_val(false) {} + expected_storage_base(const expected_storage_base &) = default; + expected_storage_base(expected_storage_base &&) = default; + expected_storage_base &operator=(const expected_storage_base &) = default; + expected_storage_base &operator=(expected_storage_base &&) = default; ~expected_storage_base() { if (!m_has_val) { m_unexpect.~unexpected(); @@ -942,14 +962,16 @@ struct expected_operations_base : expected_storage_base { // This specialization is for when T and E are trivially copy constructible template :: - value &&TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(E)::value> + value &&TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(E)::value, + bool = (is_copy_constructible_or_void::value && + std::is_copy_constructible::value)> struct expected_copy_base : expected_operations_base { using expected_operations_base::expected_operations_base; }; -// This specialization is for when T or E are not trivially copy constructible +// This specialization is for when T or E are non-trivially copy constructible template -struct expected_copy_base : expected_operations_base { +struct expected_copy_base : expected_operations_base { using expected_operations_base::expected_operations_base; expected_copy_base() = default; @@ -1010,13 +1032,17 @@ template >::value &&TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(E)::value &&TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(E)::value - &&TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(E)::value> + &&TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(E)::value, + bool = (is_copy_constructible_or_void::value && + std::is_copy_constructible::value && + is_copy_assignable_or_void::value && + std::is_copy_assignable::value)> struct expected_copy_assign_base : expected_move_base { using expected_move_base::expected_move_base; }; template -struct expected_copy_assign_base : expected_move_base { +struct expected_copy_assign_base : expected_move_base { using expected_move_base::expected_move_base; expected_copy_assign_base() = default;