From f432d3fcf8fd7894c64b175f70e75e2aa357b56b Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sun, 6 Oct 2024 18:22:06 +0300 Subject: [PATCH] BAN: Cleanup Optional casting for value getters --- BAN/include/BAN/Optional.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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