From f9a96a0a97f59a0b31ee0f901d1c21dde6b3cfaf Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 10 May 2019 20:56:16 -0700 Subject: [PATCH] [meta] More rewrites --- src/hb-meta.hh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/hb-meta.hh b/src/hb-meta.hh index 16f39eb..15c38bb 100644 --- a/src/hb-meta.hh +++ b/src/hb-meta.hh @@ -75,8 +75,8 @@ template <> struct hb_priority<0> {}; #define HB_FUNCOBJ(x) static_const x HB_UNUSED -template struct hb_match_identity { typedef T type; }; -template using hb_type_identity = typename hb_match_identity::type; +template struct hb_type_identity_t { typedef T type; }; +template using hb_type_identity = typename hb_type_identity_t::type; struct { @@ -97,14 +97,14 @@ HB_FUNCOBJ (hb_addressof); template static inline T hb_declval (); #define hb_declval(T) (hb_declval ()) -template struct hb_match_const { typedef T type; static constexpr bool value = false; }; -template struct hb_match_const { typedef T type; static constexpr bool value = true; }; +template struct hb_match_const : hb_type_identity_t, hb_bool_constant{}; +template struct hb_match_const : hb_type_identity_t, hb_bool_constant {}; template using hb_remove_const = typename hb_match_const::type; template using hb_add_const = const T; #define hb_is_const(T) hb_match_const::value -template struct hb_match_reference { typedef T type; static constexpr bool value = false; }; -template struct hb_match_reference { typedef T type; static constexpr bool value = true; }; -template struct hb_match_reference { typedef T type; static constexpr bool value = true; }; +template struct hb_match_reference : hb_type_identity_t, hb_bool_constant{}; +template struct hb_match_reference : hb_type_identity_t, hb_bool_constant {}; +template struct hb_match_reference : hb_type_identity_t, hb_bool_constant {}; template using hb_remove_reference = typename hb_match_reference::type; template auto _hb_try_add_lvalue_reference (hb_priority<1>) -> hb_type_identity; template auto _hb_try_add_lvalue_reference (hb_priority<0>) -> hb_type_identity; @@ -113,8 +113,8 @@ template auto _hb_try_add_rvalue_reference (hb_priority<1>) -> hb_t template auto _hb_try_add_rvalue_reference (hb_priority<0>) -> hb_type_identity; template using hb_add_rvalue_reference = decltype (_hb_try_add_rvalue_reference (hb_prioritize)); #define hb_is_reference(T) hb_match_reference::value -template struct hb_match_pointer { typedef T type; static constexpr bool value = false; }; -template struct hb_match_pointer { typedef T type; static constexpr bool value = true; }; +template struct hb_match_pointer : hb_type_identity_t, hb_bool_constant{}; +template struct hb_match_pointer : hb_type_identity_t, hb_bool_constant {}; template using hb_remove_pointer = typename hb_match_pointer::type; template auto _hb_try_add_pointer (hb_priority<1>) -> hb_type_identity*>; template auto _hb_try_add_pointer (hb_priority<1>) -> hb_type_identity; -- 2.7.4