[meta] More rewrites
This commit is contained in:
parent
5252677e53
commit
f9a96a0a97
|
@ -75,8 +75,8 @@ template <> struct hb_priority<0> {};
|
||||||
#define HB_FUNCOBJ(x) static_const x HB_UNUSED
|
#define HB_FUNCOBJ(x) static_const x HB_UNUSED
|
||||||
|
|
||||||
|
|
||||||
template <typename T> struct hb_match_identity { typedef T type; };
|
template <typename T> struct hb_type_identity_t { typedef T type; };
|
||||||
template <typename T> using hb_type_identity = typename hb_match_identity<T>::type;
|
template <typename T> using hb_type_identity = typename hb_type_identity_t<T>::type;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -97,14 +97,14 @@ HB_FUNCOBJ (hb_addressof);
|
||||||
template <typename T> static inline T hb_declval ();
|
template <typename T> static inline T hb_declval ();
|
||||||
#define hb_declval(T) (hb_declval<T> ())
|
#define hb_declval(T) (hb_declval<T> ())
|
||||||
|
|
||||||
template <typename T> struct hb_match_const { typedef T type; static constexpr bool value = false; };
|
template <typename T> struct hb_match_const : hb_type_identity_t<T>, hb_bool_constant<false>{};
|
||||||
template <typename T> struct hb_match_const<const T> { typedef T type; static constexpr bool value = true; };
|
template <typename T> struct hb_match_const<const T> : hb_type_identity_t<T>, hb_bool_constant<true> {};
|
||||||
template <typename T> using hb_remove_const = typename hb_match_const<T>::type;
|
template <typename T> using hb_remove_const = typename hb_match_const<T>::type;
|
||||||
template <typename T> using hb_add_const = const T;
|
template <typename T> using hb_add_const = const T;
|
||||||
#define hb_is_const(T) hb_match_const<T>::value
|
#define hb_is_const(T) hb_match_const<T>::value
|
||||||
template <typename T> struct hb_match_reference { typedef T type; static constexpr bool value = false; };
|
template <typename T> struct hb_match_reference : hb_type_identity_t<T>, hb_bool_constant<false>{};
|
||||||
template <typename T> struct hb_match_reference<T &> { typedef T type; static constexpr bool value = true; };
|
template <typename T> struct hb_match_reference<T &> : hb_type_identity_t<T>, hb_bool_constant<true> {};
|
||||||
template <typename T> struct hb_match_reference<T &&> { typedef T type; static constexpr bool value = true; };
|
template <typename T> struct hb_match_reference<T &&> : hb_type_identity_t<T>, hb_bool_constant<true> {};
|
||||||
template <typename T> using hb_remove_reference = typename hb_match_reference<T>::type;
|
template <typename T> using hb_remove_reference = typename hb_match_reference<T>::type;
|
||||||
template <typename T> auto _hb_try_add_lvalue_reference (hb_priority<1>) -> hb_type_identity<T&>;
|
template <typename T> auto _hb_try_add_lvalue_reference (hb_priority<1>) -> hb_type_identity<T&>;
|
||||||
template <typename T> auto _hb_try_add_lvalue_reference (hb_priority<0>) -> hb_type_identity<T>;
|
template <typename T> auto _hb_try_add_lvalue_reference (hb_priority<0>) -> hb_type_identity<T>;
|
||||||
|
@ -113,8 +113,8 @@ template <typename T> auto _hb_try_add_rvalue_reference (hb_priority<1>) -> hb_t
|
||||||
template <typename T> auto _hb_try_add_rvalue_reference (hb_priority<0>) -> hb_type_identity<T>;
|
template <typename T> auto _hb_try_add_rvalue_reference (hb_priority<0>) -> hb_type_identity<T>;
|
||||||
template <typename T> using hb_add_rvalue_reference = decltype (_hb_try_add_rvalue_reference<T> (hb_prioritize));
|
template <typename T> using hb_add_rvalue_reference = decltype (_hb_try_add_rvalue_reference<T> (hb_prioritize));
|
||||||
#define hb_is_reference(T) hb_match_reference<T>::value
|
#define hb_is_reference(T) hb_match_reference<T>::value
|
||||||
template <typename T> struct hb_match_pointer { typedef T type; static constexpr bool value = false; };
|
template <typename T> struct hb_match_pointer : hb_type_identity_t<T>, hb_bool_constant<false>{};
|
||||||
template <typename T> struct hb_match_pointer<T *> { typedef T type; static constexpr bool value = true; };
|
template <typename T> struct hb_match_pointer<T *> : hb_type_identity_t<T>, hb_bool_constant<true> {};
|
||||||
template <typename T> using hb_remove_pointer = typename hb_match_pointer<T>::type;
|
template <typename T> using hb_remove_pointer = typename hb_match_pointer<T>::type;
|
||||||
template <typename T> auto _hb_try_add_pointer (hb_priority<1>) -> hb_type_identity<hb_remove_reference<T>*>;
|
template <typename T> auto _hb_try_add_pointer (hb_priority<1>) -> hb_type_identity<hb_remove_reference<T>*>;
|
||||||
template <typename T> auto _hb_try_add_pointer (hb_priority<1>) -> hb_type_identity<T>;
|
template <typename T> auto _hb_try_add_pointer (hb_priority<1>) -> hb_type_identity<T>;
|
||||||
|
|
Loading…
Reference in New Issue