Result, Option: Make sure everything is properly moved
This commit is contained in:
parent
e729c38200
commit
19a4e2ab58
@ -126,7 +126,7 @@ template <typename T> class Option
|
|||||||
|
|
||||||
void store_moved_reference(T&& ref)
|
void store_moved_reference(T&& ref)
|
||||||
{
|
{
|
||||||
new (buffer) T(ref);
|
new (buffer) T(move(ref));
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroy()
|
void destroy()
|
||||||
|
@ -25,7 +25,7 @@ template <typename T> class Result
|
|||||||
m_has_error = false;
|
m_has_error = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result(T&& value) : m_value(value)
|
Result(T&& value) : m_value(move(value))
|
||||||
{
|
{
|
||||||
m_has_value = true;
|
m_has_value = true;
|
||||||
m_has_error = false;
|
m_has_error = false;
|
||||||
@ -46,7 +46,7 @@ template <typename T> class Result
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Result(Result<T>&& other) : m_value(other.m_value)
|
Result(Result<T>&& other) : m_value(move(other.m_value))
|
||||||
{
|
{
|
||||||
if (!other.m_has_error)
|
if (!other.m_has_error)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user