From 65f299038dcaee1059102c4d4bc70f5859336b74 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Mon, 3 Jun 2024 17:51:44 +0300 Subject: [PATCH] BAN: Implement traits {true,false}_type with integral_constant --- BAN/include/BAN/Traits.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/BAN/include/BAN/Traits.h b/BAN/include/BAN/Traits.h index 59029782..646e5af0 100644 --- a/BAN/include/BAN/Traits.h +++ b/BAN/include/BAN/Traits.h @@ -34,8 +34,10 @@ namespace BAN template struct either_or { using type = T1; }; template using either_or_t = typename either_or::type; - struct true_type { static constexpr bool value = true; }; - struct false_type { static constexpr bool value = false; }; + template struct integral_constant { static constexpr T value = V; }; + template inline constexpr T integral_constant_v = integral_constant::value; + using true_type = integral_constant; + using false_type = integral_constant; template struct is_same : false_type {}; template struct is_same : true_type {}; @@ -87,9 +89,6 @@ namespace BAN template struct is_base_of { static constexpr bool value = __is_base_of(Base, Derived); }; template inline constexpr bool is_base_of_v = is_base_of::value; - template struct integral_constant { static constexpr T value = V; }; - template inline constexpr T integral_constant_v = integral_constant::value; - namespace detail { template> struct is_signed { static constexpr bool value = T(-1) < T(0); };