diff --git a/BAN/include/BAN/Optional.h b/BAN/include/BAN/Optional.h index 4d50c20e73..ee893319fb 100644 --- a/BAN/include/BAN/Optional.h +++ b/BAN/include/BAN/Optional.h @@ -167,14 +167,14 @@ namespace BAN constexpr T& Optional::value() { ASSERT(has_value()); - return (T&)m_storage; + return *reinterpret_cast(&m_storage); } template constexpr const T& Optional::value() const { ASSERT(has_value()); - return (const T&)m_storage; + return *reinterpret_cast(&m_storage); } template @@ -182,7 +182,7 @@ namespace BAN { if (!has_value()) return empty; - return (T&)m_storage; + return value(); } template @@ -190,7 +190,7 @@ namespace BAN { if (!has_value()) return empty; - return (const T&)m_storage; + return value(); } template