diff --git a/src/hb-meta.hh b/src/hb-meta.hh index 645eb5439..4cf846653 100644 --- a/src/hb-meta.hh +++ b/src/hb-meta.hh @@ -102,17 +102,28 @@ template static inline 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 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 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; +template using hb_add_lvalue_reference = decltype (_hb_try_add_lvalue_reference (hb_prioritize)); +template auto _hb_try_add_rvalue_reference (hb_priority<1>) -> hb_type_identity; +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 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; +template using hb_add_pointer = decltype (_hb_try_add_pointer (hb_prioritize)); #define hb_is_pointer(T) hb_match_pointer::value + /* TODO Add feature-parity to std::decay. */ template using hb_decay = hb_remove_const>;