xref: /aosp_15_r20/external/harfbuzz_ng/src/hb-meta.hh (revision 2d1272b857b1f7575e6e246373e1cb218663db8a)
1*2d1272b8SAndroid Build Coastguard Worker /*
2*2d1272b8SAndroid Build Coastguard Worker  * Copyright © 2018  Google, Inc.
3*2d1272b8SAndroid Build Coastguard Worker  *
4*2d1272b8SAndroid Build Coastguard Worker  *  This is part of HarfBuzz, a text shaping library.
5*2d1272b8SAndroid Build Coastguard Worker  *
6*2d1272b8SAndroid Build Coastguard Worker  * Permission is hereby granted, without written agreement and without
7*2d1272b8SAndroid Build Coastguard Worker  * license or royalty fees, to use, copy, modify, and distribute this
8*2d1272b8SAndroid Build Coastguard Worker  * software and its documentation for any purpose, provided that the
9*2d1272b8SAndroid Build Coastguard Worker  * above copyright notice and the following two paragraphs appear in
10*2d1272b8SAndroid Build Coastguard Worker  * all copies of this software.
11*2d1272b8SAndroid Build Coastguard Worker  *
12*2d1272b8SAndroid Build Coastguard Worker  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13*2d1272b8SAndroid Build Coastguard Worker  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14*2d1272b8SAndroid Build Coastguard Worker  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15*2d1272b8SAndroid Build Coastguard Worker  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16*2d1272b8SAndroid Build Coastguard Worker  * DAMAGE.
17*2d1272b8SAndroid Build Coastguard Worker  *
18*2d1272b8SAndroid Build Coastguard Worker  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19*2d1272b8SAndroid Build Coastguard Worker  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20*2d1272b8SAndroid Build Coastguard Worker  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
21*2d1272b8SAndroid Build Coastguard Worker  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22*2d1272b8SAndroid Build Coastguard Worker  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23*2d1272b8SAndroid Build Coastguard Worker  *
24*2d1272b8SAndroid Build Coastguard Worker  * Google Author(s): Behdad Esfahbod
25*2d1272b8SAndroid Build Coastguard Worker  */
26*2d1272b8SAndroid Build Coastguard Worker 
27*2d1272b8SAndroid Build Coastguard Worker #ifndef HB_META_HH
28*2d1272b8SAndroid Build Coastguard Worker #define HB_META_HH
29*2d1272b8SAndroid Build Coastguard Worker 
30*2d1272b8SAndroid Build Coastguard Worker #include "hb.hh"
31*2d1272b8SAndroid Build Coastguard Worker 
32*2d1272b8SAndroid Build Coastguard Worker #include <memory>
33*2d1272b8SAndroid Build Coastguard Worker #include <type_traits>
34*2d1272b8SAndroid Build Coastguard Worker #include <utility>
35*2d1272b8SAndroid Build Coastguard Worker 
36*2d1272b8SAndroid Build Coastguard Worker 
37*2d1272b8SAndroid Build Coastguard Worker /*
38*2d1272b8SAndroid Build Coastguard Worker  * C++ template meta-programming & fundamentals used with them.
39*2d1272b8SAndroid Build Coastguard Worker  */
40*2d1272b8SAndroid Build Coastguard Worker 
41*2d1272b8SAndroid Build Coastguard Worker /* Void!  For when we need a expression-type of void. */
42*2d1272b8SAndroid Build Coastguard Worker struct hb_empty_t {};
43*2d1272b8SAndroid Build Coastguard Worker 
44*2d1272b8SAndroid Build Coastguard Worker /* https://en.cppreference.com/w/cpp/types/void_t */
45*2d1272b8SAndroid Build Coastguard Worker template<typename... Ts> struct _hb_void_t { typedef void type; };
46*2d1272b8SAndroid Build Coastguard Worker template<typename... Ts> using hb_void_t = typename _hb_void_t<Ts...>::type;
47*2d1272b8SAndroid Build Coastguard Worker 
48*2d1272b8SAndroid Build Coastguard Worker template<typename Head, typename... Ts> struct _hb_head_t { typedef Head type; };
49*2d1272b8SAndroid Build Coastguard Worker template<typename... Ts> using hb_head_t = typename _hb_head_t<Ts...>::type;
50*2d1272b8SAndroid Build Coastguard Worker 
51*2d1272b8SAndroid Build Coastguard Worker template <typename T, T v> struct hb_integral_constant { static constexpr T value = v; };
52*2d1272b8SAndroid Build Coastguard Worker template <bool b> using hb_bool_constant = hb_integral_constant<bool, b>;
53*2d1272b8SAndroid Build Coastguard Worker using hb_true_type = hb_bool_constant<true>;
54*2d1272b8SAndroid Build Coastguard Worker using hb_false_type = hb_bool_constant<false>;
55*2d1272b8SAndroid Build Coastguard Worker 
56*2d1272b8SAndroid Build Coastguard Worker /* Static-assert as expression. */
57*2d1272b8SAndroid Build Coastguard Worker template <bool cond> struct static_assert_expr;
58*2d1272b8SAndroid Build Coastguard Worker template <> struct static_assert_expr<true> : hb_false_type {};
59*2d1272b8SAndroid Build Coastguard Worker #define static_assert_expr(C) static_assert_expr<C>::value
60*2d1272b8SAndroid Build Coastguard Worker 
61*2d1272b8SAndroid Build Coastguard Worker /* Basic type SFINAE. */
62*2d1272b8SAndroid Build Coastguard Worker 
63*2d1272b8SAndroid Build Coastguard Worker template <bool B, typename T = void> struct hb_enable_if {};
64*2d1272b8SAndroid Build Coastguard Worker template <typename T>                struct hb_enable_if<true, T> { typedef T type; };
65*2d1272b8SAndroid Build Coastguard Worker #define hb_enable_if(Cond) typename hb_enable_if<(Cond)>::type* = nullptr
66*2d1272b8SAndroid Build Coastguard Worker /* Concepts/Requires alias: */
67*2d1272b8SAndroid Build Coastguard Worker #define hb_requires(Cond) hb_enable_if((Cond))
68*2d1272b8SAndroid Build Coastguard Worker 
69*2d1272b8SAndroid Build Coastguard Worker template <typename T, typename T2> struct hb_is_same : hb_false_type {};
70*2d1272b8SAndroid Build Coastguard Worker template <typename T>              struct hb_is_same<T, T> : hb_true_type {};
71*2d1272b8SAndroid Build Coastguard Worker #define hb_is_same(T, T2) hb_is_same<T, T2>::value
72*2d1272b8SAndroid Build Coastguard Worker 
73*2d1272b8SAndroid Build Coastguard Worker /* Function overloading SFINAE and priority. */
74*2d1272b8SAndroid Build Coastguard Worker 
75*2d1272b8SAndroid Build Coastguard Worker #define HB_RETURN(Ret, E) -> hb_head_t<Ret, decltype ((E))> { return (E); }
76*2d1272b8SAndroid Build Coastguard Worker #define HB_AUTO_RETURN(E) -> decltype ((E)) { return (E); }
77*2d1272b8SAndroid Build Coastguard Worker #define HB_VOID_RETURN(E) -> hb_void_t<decltype ((E))> { (E); }
78*2d1272b8SAndroid Build Coastguard Worker 
79*2d1272b8SAndroid Build Coastguard Worker template <unsigned Pri> struct hb_priority : hb_priority<Pri - 1> {};
80*2d1272b8SAndroid Build Coastguard Worker template <>             struct hb_priority<0> {};
81*2d1272b8SAndroid Build Coastguard Worker #define hb_prioritize hb_priority<16> ()
82*2d1272b8SAndroid Build Coastguard Worker 
83*2d1272b8SAndroid Build Coastguard Worker #define HB_FUNCOBJ(x) static_const x HB_UNUSED
84*2d1272b8SAndroid Build Coastguard Worker 
85*2d1272b8SAndroid Build Coastguard Worker 
86*2d1272b8SAndroid Build Coastguard Worker template <typename T> struct hb_type_identity_t { typedef T type; };
87*2d1272b8SAndroid Build Coastguard Worker template <typename T> using hb_type_identity = typename hb_type_identity_t<T>::type;
88*2d1272b8SAndroid Build Coastguard Worker 
89*2d1272b8SAndroid Build Coastguard Worker template <typename T> static inline T hb_declval ();
90*2d1272b8SAndroid Build Coastguard Worker #define hb_declval(T) (hb_declval<T> ())
91*2d1272b8SAndroid Build Coastguard Worker 
92*2d1272b8SAndroid Build Coastguard Worker template <typename T> struct hb_match_const		: hb_type_identity_t<T>, hb_false_type	{};
93*2d1272b8SAndroid Build Coastguard Worker template <typename T> struct hb_match_const<const T>	: hb_type_identity_t<T>, hb_true_type	{};
94*2d1272b8SAndroid Build Coastguard Worker template <typename T> using hb_remove_const = typename hb_match_const<T>::type;
95*2d1272b8SAndroid Build Coastguard Worker 
96*2d1272b8SAndroid Build Coastguard Worker template <typename T> struct hb_match_reference		: hb_type_identity_t<T>, hb_false_type	{};
97*2d1272b8SAndroid Build Coastguard Worker template <typename T> struct hb_match_reference<T &>	: hb_type_identity_t<T>, hb_true_type	{};
98*2d1272b8SAndroid Build Coastguard Worker template <typename T> struct hb_match_reference<T &&>	: hb_type_identity_t<T>, hb_true_type	{};
99*2d1272b8SAndroid Build Coastguard Worker template <typename T> using hb_remove_reference = typename hb_match_reference<T>::type;
100*2d1272b8SAndroid Build Coastguard Worker template <typename T> auto _hb_try_add_lvalue_reference (hb_priority<1>) -> hb_type_identity<T&>;
101*2d1272b8SAndroid Build Coastguard Worker template <typename T> auto _hb_try_add_lvalue_reference (hb_priority<0>) -> hb_type_identity<T>;
102*2d1272b8SAndroid Build Coastguard Worker template <typename T> using hb_add_lvalue_reference = decltype (_hb_try_add_lvalue_reference<T> (hb_prioritize));
103*2d1272b8SAndroid Build Coastguard Worker template <typename T> auto _hb_try_add_rvalue_reference (hb_priority<1>) -> hb_type_identity<T&&>;
104*2d1272b8SAndroid Build Coastguard Worker template <typename T> auto _hb_try_add_rvalue_reference (hb_priority<0>) -> hb_type_identity<T>;
105*2d1272b8SAndroid Build Coastguard Worker template <typename T> using hb_add_rvalue_reference = decltype (_hb_try_add_rvalue_reference<T> (hb_prioritize));
106*2d1272b8SAndroid Build Coastguard Worker 
107*2d1272b8SAndroid Build Coastguard Worker template <typename T> struct hb_match_pointer		: hb_type_identity_t<T>, hb_false_type	{};
108*2d1272b8SAndroid Build Coastguard Worker template <typename T> struct hb_match_pointer<T *>	: hb_type_identity_t<T>, hb_true_type	{};
109*2d1272b8SAndroid Build Coastguard Worker template <typename T> using hb_remove_pointer = typename hb_match_pointer<T>::type;
110*2d1272b8SAndroid Build Coastguard Worker template <typename T> auto _hb_try_add_pointer (hb_priority<1>) -> hb_type_identity<hb_remove_reference<T>*>;
111*2d1272b8SAndroid Build Coastguard Worker template <typename T> auto _hb_try_add_pointer (hb_priority<1>) -> hb_type_identity<T>;
112*2d1272b8SAndroid Build Coastguard Worker template <typename T> using hb_add_pointer = decltype (_hb_try_add_pointer<T> (hb_prioritize));
113*2d1272b8SAndroid Build Coastguard Worker 
114*2d1272b8SAndroid Build Coastguard Worker 
115*2d1272b8SAndroid Build Coastguard Worker template <typename T> using hb_decay = typename std::decay<T>::type;
116*2d1272b8SAndroid Build Coastguard Worker 
117*2d1272b8SAndroid Build Coastguard Worker #define hb_is_convertible(From,To) std::is_convertible<From, To>::value
118*2d1272b8SAndroid Build Coastguard Worker 
119*2d1272b8SAndroid Build Coastguard Worker template <typename From, typename To>
120*2d1272b8SAndroid Build Coastguard Worker using hb_is_cr_convertible = hb_bool_constant<
121*2d1272b8SAndroid Build Coastguard Worker   hb_is_same (hb_decay<From>, hb_decay<To>) &&
122*2d1272b8SAndroid Build Coastguard Worker   (!std::is_const<From>::value || std::is_const<To>::value) &&
123*2d1272b8SAndroid Build Coastguard Worker   (!std::is_reference<To>::value || std::is_const<To>::value || std::is_reference<To>::value)
124*2d1272b8SAndroid Build Coastguard Worker >;
125*2d1272b8SAndroid Build Coastguard Worker #define hb_is_cr_convertible(From,To) hb_is_cr_convertible<From, To>::value
126*2d1272b8SAndroid Build Coastguard Worker 
127*2d1272b8SAndroid Build Coastguard Worker 
128*2d1272b8SAndroid Build Coastguard Worker struct
129*2d1272b8SAndroid Build Coastguard Worker {
130*2d1272b8SAndroid Build Coastguard Worker   template <typename T> constexpr auto
131*2d1272b8SAndroid Build Coastguard Worker   operator () (T&& v) const HB_AUTO_RETURN (std::forward<T> (v))
132*2d1272b8SAndroid Build Coastguard Worker 
133*2d1272b8SAndroid Build Coastguard Worker   template <typename T> constexpr auto
134*2d1272b8SAndroid Build Coastguard Worker   operator () (T *v) const HB_AUTO_RETURN (*v)
135*2d1272b8SAndroid Build Coastguard Worker 
136*2d1272b8SAndroid Build Coastguard Worker   template <typename T> constexpr auto
137*2d1272b8SAndroid Build Coastguard Worker   operator () (const hb::shared_ptr<T>& v) const HB_AUTO_RETURN (*v)
138*2d1272b8SAndroid Build Coastguard Worker 
139*2d1272b8SAndroid Build Coastguard Worker   template <typename T> constexpr auto
140*2d1272b8SAndroid Build Coastguard Worker   operator () (hb::shared_ptr<T>& v) const HB_AUTO_RETURN (*v)
141*2d1272b8SAndroid Build Coastguard Worker 
142*2d1272b8SAndroid Build Coastguard Worker   template <typename T> constexpr auto
143*2d1272b8SAndroid Build Coastguard Worker   operator () (const hb::unique_ptr<T>& v) const HB_AUTO_RETURN (*v)
144*2d1272b8SAndroid Build Coastguard Worker 
145*2d1272b8SAndroid Build Coastguard Worker   template <typename T> constexpr auto
146*2d1272b8SAndroid Build Coastguard Worker   operator () (hb::unique_ptr<T>& v) const HB_AUTO_RETURN (*v)
147*2d1272b8SAndroid Build Coastguard Worker }
148*2d1272b8SAndroid Build Coastguard Worker HB_FUNCOBJ (hb_deref);
149*2d1272b8SAndroid Build Coastguard Worker 
150*2d1272b8SAndroid Build Coastguard Worker template <typename T>
151*2d1272b8SAndroid Build Coastguard Worker struct hb_reference_wrapper
152*2d1272b8SAndroid Build Coastguard Worker {
hb_reference_wrapperhb_reference_wrapper153*2d1272b8SAndroid Build Coastguard Worker   hb_reference_wrapper (T v) : v (v) {}
operator ==hb_reference_wrapper154*2d1272b8SAndroid Build Coastguard Worker   bool operator == (const hb_reference_wrapper& o) const { return v == o.v; }
operator !=hb_reference_wrapper155*2d1272b8SAndroid Build Coastguard Worker   bool operator != (const hb_reference_wrapper& o) const { return v != o.v; }
operator T&hb_reference_wrapper156*2d1272b8SAndroid Build Coastguard Worker   operator T& () { return v; }
gethb_reference_wrapper157*2d1272b8SAndroid Build Coastguard Worker   T& get () { return v; }
158*2d1272b8SAndroid Build Coastguard Worker   T v;
159*2d1272b8SAndroid Build Coastguard Worker };
160*2d1272b8SAndroid Build Coastguard Worker template <typename T>
161*2d1272b8SAndroid Build Coastguard Worker struct hb_reference_wrapper<T&>
162*2d1272b8SAndroid Build Coastguard Worker {
hb_reference_wrapperhb_reference_wrapper163*2d1272b8SAndroid Build Coastguard Worker   hb_reference_wrapper (T& v) : v (std::addressof (v)) {}
operator ==hb_reference_wrapper164*2d1272b8SAndroid Build Coastguard Worker   bool operator == (const hb_reference_wrapper& o) const { return v == o.v; }
operator !=hb_reference_wrapper165*2d1272b8SAndroid Build Coastguard Worker   bool operator != (const hb_reference_wrapper& o) const { return v != o.v; }
operator T&hb_reference_wrapper166*2d1272b8SAndroid Build Coastguard Worker   operator T& () { return *v; }
gethb_reference_wrapper167*2d1272b8SAndroid Build Coastguard Worker   T& get () { return *v; }
168*2d1272b8SAndroid Build Coastguard Worker   T* v;
169*2d1272b8SAndroid Build Coastguard Worker };
170*2d1272b8SAndroid Build Coastguard Worker 
171*2d1272b8SAndroid Build Coastguard Worker 
172*2d1272b8SAndroid Build Coastguard Worker /* Type traits */
173*2d1272b8SAndroid Build Coastguard Worker 
174*2d1272b8SAndroid Build Coastguard Worker template <typename T> struct hb_int_min;
175*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_min<char>			: hb_integral_constant<char,			CHAR_MIN>	{};
176*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_min<signed char>		: hb_integral_constant<signed char,		SCHAR_MIN>	{};
177*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_min<unsigned char>		: hb_integral_constant<unsigned char,		0>		{};
178*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_min<signed short>		: hb_integral_constant<signed short,		SHRT_MIN>	{};
179*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_min<unsigned short>		: hb_integral_constant<unsigned short,		0>		{};
180*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_min<signed int>		: hb_integral_constant<signed int,		INT_MIN>	{};
181*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_min<unsigned int>		: hb_integral_constant<unsigned int,		0>		{};
182*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_min<signed long>		: hb_integral_constant<signed long,		LONG_MIN>	{};
183*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_min<unsigned long>		: hb_integral_constant<unsigned long,		0>		{};
184*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_min<signed long long>		: hb_integral_constant<signed long long,	LLONG_MIN>	{};
185*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_min<unsigned long long>	: hb_integral_constant<unsigned long long,	0>		{};
186*2d1272b8SAndroid Build Coastguard Worker template <typename T> struct hb_int_min<T *>		: hb_integral_constant<T *,			nullptr>	{};
187*2d1272b8SAndroid Build Coastguard Worker #define hb_int_min(T) hb_int_min<T>::value
188*2d1272b8SAndroid Build Coastguard Worker template <typename T> struct hb_int_max;
189*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_max<char>			: hb_integral_constant<char,			CHAR_MAX>	{};
190*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_max<signed char>		: hb_integral_constant<signed char,		SCHAR_MAX>	{};
191*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_max<unsigned char>		: hb_integral_constant<unsigned char,		UCHAR_MAX>	{};
192*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_max<signed short>		: hb_integral_constant<signed short,		SHRT_MAX>	{};
193*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_max<unsigned short>		: hb_integral_constant<unsigned short,		USHRT_MAX>	{};
194*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_max<signed int>		: hb_integral_constant<signed int,		INT_MAX>	{};
195*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_max<unsigned int>		: hb_integral_constant<unsigned int,		UINT_MAX>	{};
196*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_max<signed long>		: hb_integral_constant<signed long,		LONG_MAX>	{};
197*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_max<unsigned long>		: hb_integral_constant<unsigned long,		ULONG_MAX>	{};
198*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_max<signed long long>		: hb_integral_constant<signed long long,	LLONG_MAX>	{};
199*2d1272b8SAndroid Build Coastguard Worker template <> struct hb_int_max<unsigned long long>	: hb_integral_constant<unsigned long long,	ULLONG_MAX>	{};
200*2d1272b8SAndroid Build Coastguard Worker #define hb_int_max(T) hb_int_max<T>::value
201*2d1272b8SAndroid Build Coastguard Worker 
202*2d1272b8SAndroid Build Coastguard Worker #if defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__)
203*2d1272b8SAndroid Build Coastguard Worker #define hb_is_trivially_copyable(T) __has_trivial_copy(T)
204*2d1272b8SAndroid Build Coastguard Worker #define hb_is_trivially_copy_assignable(T) __has_trivial_assign(T)
205*2d1272b8SAndroid Build Coastguard Worker #define hb_is_trivially_constructible(T) __has_trivial_constructor(T)
206*2d1272b8SAndroid Build Coastguard Worker #define hb_is_trivially_copy_constructible(T) __has_trivial_copy_constructor(T)
207*2d1272b8SAndroid Build Coastguard Worker #define hb_is_trivially_destructible(T) __has_trivial_destructor(T)
208*2d1272b8SAndroid Build Coastguard Worker #else
209*2d1272b8SAndroid Build Coastguard Worker #define hb_is_trivially_copyable(T) std::is_trivially_copyable<T>::value
210*2d1272b8SAndroid Build Coastguard Worker #define hb_is_trivially_copy_assignable(T) std::is_trivially_copy_assignable<T>::value
211*2d1272b8SAndroid Build Coastguard Worker #define hb_is_trivially_constructible(T) std::is_trivially_constructible<T>::value
212*2d1272b8SAndroid Build Coastguard Worker #define hb_is_trivially_copy_constructible(T) std::is_trivially_copy_constructible<T>::value
213*2d1272b8SAndroid Build Coastguard Worker #define hb_is_trivially_destructible(T) std::is_trivially_destructible<T>::value
214*2d1272b8SAndroid Build Coastguard Worker #endif
215*2d1272b8SAndroid Build Coastguard Worker 
216*2d1272b8SAndroid Build Coastguard Worker /* Class traits. */
217*2d1272b8SAndroid Build Coastguard Worker 
218*2d1272b8SAndroid Build Coastguard Worker #define HB_DELETE_COPY_ASSIGN(TypeName) \
219*2d1272b8SAndroid Build Coastguard Worker   TypeName(const TypeName&) = delete; \
220*2d1272b8SAndroid Build Coastguard Worker   void operator=(const TypeName&) = delete
221*2d1272b8SAndroid Build Coastguard Worker #define HB_DELETE_CREATE_COPY_ASSIGN(TypeName) \
222*2d1272b8SAndroid Build Coastguard Worker   TypeName() = delete; \
223*2d1272b8SAndroid Build Coastguard Worker   TypeName(const TypeName&) = delete; \
224*2d1272b8SAndroid Build Coastguard Worker   void operator=(const TypeName&) = delete
225*2d1272b8SAndroid Build Coastguard Worker 
226*2d1272b8SAndroid Build Coastguard Worker /* hb_unwrap_type (T)
227*2d1272b8SAndroid Build Coastguard Worker  * If T has no T::type, returns T. Otherwise calls itself on T::type recursively.
228*2d1272b8SAndroid Build Coastguard Worker  */
229*2d1272b8SAndroid Build Coastguard Worker 
230*2d1272b8SAndroid Build Coastguard Worker template <typename T, typename>
231*2d1272b8SAndroid Build Coastguard Worker struct _hb_unwrap_type : hb_type_identity_t<T> {};
232*2d1272b8SAndroid Build Coastguard Worker template <typename T>
233*2d1272b8SAndroid Build Coastguard Worker struct _hb_unwrap_type<T, hb_void_t<typename T::type>> : _hb_unwrap_type<typename T::type, void> {};
234*2d1272b8SAndroid Build Coastguard Worker template <typename T>
235*2d1272b8SAndroid Build Coastguard Worker using hb_unwrap_type = _hb_unwrap_type<T, void>;
236*2d1272b8SAndroid Build Coastguard Worker #define hb_unwrap_type(T) typename hb_unwrap_type<T>::type
237*2d1272b8SAndroid Build Coastguard Worker 
238*2d1272b8SAndroid Build Coastguard Worker #endif /* HB_META_HH */
239