diff --git a/source/mijin/container/optional.hpp b/source/mijin/container/optional.hpp index 57b2ac4..4e9148d 100644 --- a/source/mijin/container/optional.hpp +++ b/source/mijin/container/optional.hpp @@ -173,7 +173,12 @@ Optional::Optional(Optional&& other) noexcept { if (other) { - emplace(std::move(other.get())); + if constexpr (!std::is_reference_v) { + emplace(std::move(other.get())); + } + else { + emplace(other.get()); + } other.reset(); } }