Fix some small issues #93
1 changed files with 3 additions and 47 deletions
|
|
@ -63,32 +63,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
// void swap(Expected& rhs)
|
||||
// {
|
||||
// if (m_valid) {
|
||||
// if (rhs.m_valid) {
|
||||
// using std::swap;
|
||||
// swap(m_value, rhs.m_value);
|
||||
// }
|
||||
// else {
|
||||
// auto t = std::move(rhs.m_error);
|
||||
// new(&rhs.m_value) T(std::move(m_value));
|
||||
// new(&m_error) std::exception_ptr(t);
|
||||
// std::swap(m_valid, rhs.m_valid);
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// if (rhs.m_valid) {
|
||||
// rhs.swap(*this);
|
||||
// }
|
||||
// else {
|
||||
// using std::swap;
|
||||
// swap(m_error, rhs.m_error);
|
||||
// std::swap(m_valid, rhs.m_valid);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
template <class E>
|
||||
static Expected<T> fromException(const E& exception)
|
||||
{
|
||||
|
|
@ -144,6 +118,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
catch (...) {
|
||||
// The stored exception is not of type E. It is still held in m_error.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -168,7 +143,7 @@ class Expected<void> {
|
|||
|
||||
public:
|
||||
|
||||
Expected<void>()
|
||||
Expected()
|
||||
: m_valid(true)
|
||||
{}
|
||||
|
||||
|
|
@ -186,26 +161,6 @@ public:
|
|||
~Expected()
|
||||
{}
|
||||
|
||||
// void swap(Expected& rhs)
|
||||
// {
|
||||
// if (m_valid) {
|
||||
// if (!rhs.m_valid) {
|
||||
// m_error = rhs.m_error;
|
||||
// std::swap(m_valid, rhs.m_valid);
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// if (rhs.m_valid) {
|
||||
// rhs.swap(*this);
|
||||
// }
|
||||
// else {
|
||||
// using std::swap;
|
||||
// swap(m_error, rhs.m_error);
|
||||
// std::swap(m_valid, rhs.m_valid);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
template <class E>
|
||||
static Expected<void> fromException(const E& exception)
|
||||
{
|
||||
|
|
@ -253,6 +208,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
catch (...) {
|
||||
// The stored exception is not of type E. It is still held in m_error.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue