From 2bcea545f5462db03bd603a46992ca57ccd15856 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 6 Nov 2021 12:53:23 -0500 Subject: [PATCH] [ox/std] Make most of Optional constexpr --- deps/ox/src/ox/std/optional.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/deps/ox/src/ox/std/optional.hpp b/deps/ox/src/ox/std/optional.hpp index 4c3e9b4f..1c566f81 100644 --- a/deps/ox/src/ox/std/optional.hpp +++ b/deps/ox/src/ox/std/optional.hpp @@ -21,12 +21,12 @@ template class Optional { private: T *m_ptr = nullptr; - char m_data[buffSize]; + char m_data[buffSize] = {}; public: - Optional() noexcept = default; + constexpr Optional() noexcept = default; - Optional(const Optional &other) { + constexpr Optional(const Optional &other) { if (m_ptr) { m_ptr->~T(); } @@ -37,7 +37,7 @@ class Optional { } } - Optional(const Optional &&other) noexcept { + constexpr Optional(const Optional &&other) noexcept { if (m_ptr) { m_ptr->~T(); } @@ -82,7 +82,7 @@ class Optional { return m_ptr; } - Optional &operator=(const Optional &other) { + constexpr Optional &operator=(const Optional &other) { if (this == &other) { return *this; } @@ -97,7 +97,7 @@ class Optional { return *this; } - Optional &operator=(Optional &&other) noexcept { + constexpr Optional &operator=(Optional &&other) noexcept { if (this == &other) { return *this; }