From f6b1c97cb9e5c6d3d13d0c82ae0be7a6abb7a000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Sat, 11 Apr 2020 12:30:35 -0700 Subject: [PATCH] Fixed issue #236. --- include/bx/bx.h | 6 +----- include/bx/inline/bx.inl | 15 +++++---------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/include/bx/bx.h b/include/bx/bx.h index 86449a2..7ad7322 100644 --- a/include/bx/bx.h +++ b/include/bx/bx.h @@ -23,17 +23,13 @@ #define BX_IGNORE_C4127(_x) bx::ignoreC4127(!!(_x) ) /// -#define BX_ENABLED(_x) bx::isEnabled() +#define BX_ENABLED(_x) (bx::isEnabled::value) namespace bx { constexpr int32_t kExitSuccess = 0; constexpr int32_t kExitFailure = 1; - /// Template for avoiding MSVC: C4127: conditional expression is constant - template - constexpr bool isEnabled(); - /// template constexpr bool isTriviallyCopyable(); diff --git a/include/bx/inline/bx.inl b/include/bx/inline/bx.inl index b54e8dd..1cf53a5 100644 --- a/include/bx/inline/bx.inl +++ b/include/bx/inline/bx.inl @@ -15,17 +15,12 @@ namespace bx template char(&CountOfRequireArrayArgumentT(const Ty(&)[Num]))[Num]; - template - BX_FORCE_INLINE constexpr bool isEnabled() + template + struct isEnabled { - return true; - } - - template<> - BX_FORCE_INLINE constexpr bool isEnabled() - { - return false; - } + // Template for avoiding MSVC: C4127: conditional expression is constant + static constexpr bool value = B; + }; inline constexpr bool ignoreC4127(bool _x) {