Fix: some typos and refactoring errors in expected

This commit is contained in:
Eelke Klein 2017-01-16 16:47:37 +01:00
parent a32e2c83ca
commit cb237b0c52

View file

@ -22,14 +22,14 @@ public:
{} {}
Expected(const Expected& ths) Expected(const Expected& rhs)
: m_valid(rhs.valid) : m_valid(rhs.valid)
{ {
if (m_valid) { if (m_valid) {
new (&m_value) T(rhs.ham); new (&m_value) T(rhs.m_value);
} }
else { else {
new (&m_error) std::exception_ptr(rhs.spam); new (&m_error) std::exception_ptr(rhs.m_error);
} }
} }
@ -66,7 +66,7 @@ public:
auto t = std::move(rhs.m_error); auto t = std::move(rhs.m_error);
new(&rhs.m_value) T(std::move(m_value)); new(&rhs.m_value) T(std::move(m_value));
new(&m_error) std::exception_ptr(t); new(&m_error) std::exception_ptr(t);
std::swap(m_valid, rhs.getHam); std::swap(m_valid, rhs.m_valid);
} }
} }
else { else {