From a6e898c7beea91189bd806c0713faf0b0ae86840 Mon Sep 17 00:00:00 2001 From: mogemimi Date: Sun, 28 Jan 2018 02:15:32 +0900 Subject: [PATCH] Remove POMDOG_CONSTEXPR_ASSERT macro --- include/Pomdog/Utility/Assert.hpp | 18 ------------------ include/Pomdog/Utility/Optional.hpp | 9 ++++++--- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/include/Pomdog/Utility/Assert.hpp b/include/Pomdog/Utility/Assert.hpp index 7effd154c..62d3a7852 100644 --- a/include/Pomdog/Utility/Assert.hpp +++ b/include/Pomdog/Utility/Assert.hpp @@ -61,23 +61,5 @@ namespace Detail { # define POMDOG_ASSERT_MESSAGE(expression, message) #endif -#if defined(DEBUG) -namespace Assertion { - -inline constexpr bool ConstexprAssert(bool condition) -{ - return (assert(condition), condition); -} - -} // namespace Assertion -# // Debug mode -# define POMDOG_CONSTEXPR_ASSERT(expression) \ - static_cast(Pomdog::Detail::Assertion::ConstexprAssert( \ - static_cast(expression))) -#else -# // Release mode -# define POMDOG_CONSTEXPR_ASSERT(expression) static_cast(0) -#endif - } // namespace Detail } // namespace Pomdog diff --git a/include/Pomdog/Utility/Optional.hpp b/include/Pomdog/Utility/Optional.hpp index daa045658..1401038c5 100644 --- a/include/Pomdog/Utility/Optional.hpp +++ b/include/Pomdog/Utility/Optional.hpp @@ -71,7 +71,8 @@ class Optional final { constexpr const T* operator->() const noexcept { - return POMDOG_CONSTEXPR_ASSERT(valid), &data; + POMDOG_ASSERT(valid); + return &data; } T* operator->() noexcept @@ -82,7 +83,8 @@ class Optional final { constexpr const T& operator*() const { - return POMDOG_CONSTEXPR_ASSERT(valid), data; + POMDOG_ASSERT(valid); + return data; } T & operator*() @@ -98,7 +100,8 @@ class Optional final { constexpr const T& value() const { - return POMDOG_CONSTEXPR_ASSERT(valid), data; + POMDOG_ASSERT(valid); + return data; } T & value()