From 7d52a7534839f1dbc017de116d73e2bbe74e2a1b Mon Sep 17 00:00:00 2001 From: q66 Date: Thu, 14 Jan 2016 18:49:38 +0000 Subject: [PATCH] convert some traits to cleaner syntax --- ostd/type_traits.hh | 52 ++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/ostd/type_traits.hh b/ostd/type_traits.hh index 8a026e3..8f0449c 100644 --- a/ostd/type_traits.hh +++ b/ostd/type_traits.hh @@ -126,59 +126,59 @@ constexpr bool IsNullPointer = IsSame, Nullptr>; /* is integer */ namespace detail { - template struct IsIntegralBase: False {}; + template constexpr bool IsIntegralBase = false; - template<> struct IsIntegralBase: True {}; - template<> struct IsIntegralBase: True {}; - template<> struct IsIntegralBase: True {}; - template<> struct IsIntegralBase: True {}; - template<> struct IsIntegralBase: True {}; + template<> constexpr bool IsIntegralBase = true; + template<> constexpr bool IsIntegralBase = true; + template<> constexpr bool IsIntegralBase = true; + template<> constexpr bool IsIntegralBase = true; + template<> constexpr bool IsIntegralBase = true; - template<> struct IsIntegralBase: True {}; - template<> struct IsIntegralBase: True {}; - template<> struct IsIntegralBase: True {}; - template<> struct IsIntegralBase: True {}; - template<> struct IsIntegralBase: True {}; - template<> struct IsIntegralBase: True {}; - template<> struct IsIntegralBase: True {}; + template<> constexpr bool IsIntegralBase = true; + template<> constexpr bool IsIntegralBase = true; + template<> constexpr bool IsIntegralBase = true; + template<> constexpr bool IsIntegralBase = true; + template<> constexpr bool IsIntegralBase = true; + template<> constexpr bool IsIntegralBase = true; + template<> constexpr bool IsIntegralBase = true; - template<> struct IsIntegralBase: True {}; - template<> struct IsIntegralBase: True {}; - template<> struct IsIntegralBase: True {}; + template<> constexpr bool IsIntegralBase = true; + template<> constexpr bool IsIntegralBase = true; + template<> constexpr bool IsIntegralBase = true; } template -constexpr bool IsIntegral = detail::IsIntegralBase>::value; +constexpr bool IsIntegral = detail::IsIntegralBase>; /* is floating point */ namespace detail { - template struct IsFloatingPointBase: False {}; + template constexpr bool IsFloatingPointBase = false; - template<> struct IsFloatingPointBase: True {}; - template<> struct IsFloatingPointBase: True {}; + template<> constexpr bool IsFloatingPointBase = true; + template<> constexpr bool IsFloatingPointBase = true; - template<> struct IsFloatingPointBase: True {}; + template<> constexpr bool IsFloatingPointBase = true; } template -constexpr bool IsFloatingPoint = detail::IsFloatingPointBase>::value; +constexpr bool IsFloatingPoint = detail::IsFloatingPointBase>; /* is array */ template constexpr bool IsArray = false; -template constexpr bool IsArray = true; +template constexpr bool IsArray = true; template constexpr bool IsArray = true; /* is pointer */ namespace detail { - template struct IsPointerBase : False {}; - template struct IsPointerBase: True {}; + template constexpr bool IsPointerBase = false; + template constexpr bool IsPointerBase = true; } template -constexpr bool IsPointer = detail::IsPointerBase>::value; +constexpr bool IsPointer = detail::IsPointerBase>; /* is lvalue reference */