diff --git a/src/ox/std/memory.hpp b/src/ox/std/memory.hpp index 543a711fc..0337ba56c 100644 --- a/src/ox/std/memory.hpp +++ b/src/ox/std/memory.hpp @@ -44,15 +44,17 @@ class UniquePtr { return m_t; } - constexpr void reset(UniquePtr &&other = UniquePtr()) { + template + constexpr void reset(UniquePtr &&other = UniquePtr()) { auto t = m_t; m_t = other.m_t; other.m_t = nullptr; delete t; } - constexpr UniquePtr &operator=(UniquePtr &&other) { - reset(ox::move(other)); + template + constexpr UniquePtr &operator=(UniquePtr &&other) { + reset(move(other)); return *this; } @@ -71,33 +73,33 @@ class UniquePtr { }; template -constexpr bool operator==(const UniquePtr p1, const UniquePtr p2) noexcept { +constexpr bool operator==(const UniquePtr &p1, const UniquePtr &p2) noexcept { return p1.get() == p2.get(); } template -constexpr bool operator==(const UniquePtr p1, std::nullptr_t) noexcept { +constexpr bool operator==(const UniquePtr &p1, std::nullptr_t) noexcept { return p1.get(); } template -constexpr bool operator==(std::nullptr_t, const UniquePtr p2) noexcept { +constexpr bool operator==(std::nullptr_t, const UniquePtr &p2) noexcept { return p2.get(); } template -constexpr bool operator!=(const UniquePtr p1, const UniquePtr p2) noexcept { +constexpr bool operator!=(const UniquePtr &p1, const UniquePtr &p2) noexcept { return p1.get() != p2.get(); } template -constexpr bool operator!=(const UniquePtr p1, std::nullptr_t) noexcept { +constexpr bool operator!=(const UniquePtr &p1, std::nullptr_t) noexcept { return !p1.get(); } template -constexpr bool operator!=(std::nullptr_t, const UniquePtr p2) noexcept { +constexpr bool operator!=(std::nullptr_t, const UniquePtr &p2) noexcept { return !p2.get(); }