Fixed issue #236.

This commit is contained in:
Бранимир Караџић
2020-04-11 12:30:35 -07:00
parent 927a02a3a1
commit f6b1c97cb9
2 changed files with 6 additions and 15 deletions

View File

@@ -23,17 +23,13 @@
#define BX_IGNORE_C4127(_x) bx::ignoreC4127(!!(_x) )
///
#define BX_ENABLED(_x) bx::isEnabled<!!(_x)>()
#define BX_ENABLED(_x) (bx::isEnabled<!!(_x)>::value)
namespace bx
{
constexpr int32_t kExitSuccess = 0;
constexpr int32_t kExitFailure = 1;
/// Template for avoiding MSVC: C4127: conditional expression is constant
template<bool>
constexpr bool isEnabled();
///
template<class Ty>
constexpr bool isTriviallyCopyable();

View File

@@ -15,17 +15,12 @@ namespace bx
template<typename Ty, size_t Num>
char(&CountOfRequireArrayArgumentT(const Ty(&)[Num]))[Num];
template<bool>
BX_FORCE_INLINE constexpr bool isEnabled()
template<bool B>
struct isEnabled
{
return true;
}
template<>
BX_FORCE_INLINE constexpr bool isEnabled<false>()
{
return false;
}
// Template for avoiding MSVC: C4127: conditional expression is constant
static constexpr bool value = B;
};
inline constexpr bool ignoreC4127(bool _x)
{