Fix missing return *this in Result class

This commit is contained in:
Charles Giessen 2023-10-30 09:15:13 -06:00 committed by Charles Giessen
parent 99be60aa19
commit ed31a4d1b1

View File

@ -80,6 +80,7 @@ template <typename T> class Result {
new (&m_value) T{ result.m_value }; new (&m_value) T{ result.m_value };
else else
m_error = result.m_error; m_error = result.m_error;
return *this;
} }
Result(Result&& expected) noexcept : m_init(expected.m_init) { Result(Result&& expected) noexcept : m_init(expected.m_init) {
if (m_init) if (m_init)
@ -94,6 +95,7 @@ template <typename T> class Result {
new (&m_value) T{ std::move(result.m_value) }; new (&m_value) T{ std::move(result.m_value) };
else else
m_error = std::move(result.m_error); m_error = std::move(result.m_error);
return *this;
} }
Result& operator=(const T& expect) noexcept { Result& operator=(const T& expect) noexcept {
destroy(); destroy();