Fixed optional move constructor for references.

This commit is contained in:
Patrick 2023-11-16 23:39:19 +01:00
parent 5aecd20c56
commit 55486b49dc

View File

@ -173,7 +173,12 @@ Optional<TValue>::Optional(Optional&& other) noexcept
{ {
if (other) if (other)
{ {
emplace(std::move(other.get())); if constexpr (!std::is_reference_v<TValue>) {
emplace(std::move(other.get()));
}
else {
emplace(other.get());
}
other.reset(); other.reset();
} }
} }