Use hb_void_t<> the way it's supposed to be used

This commit is contained in:
Behdad Esfahbod 2019-05-10 21:03:14 -07:00
parent 40fb36a39d
commit c0485e32a3
1 changed files with 6 additions and 6 deletions

View File

@ -46,13 +46,13 @@
* https://stackoverflow.com/questions/7776448/sfinae-tried-with-bool-gives-compiler-error-template-argument-tvalue-invol
*/
template <typename T, typename B>
template <typename T, typename>
struct _hb_null_size : hb_integral_constant<unsigned, sizeof (T)> {};
template <typename T>
struct _hb_null_size<T, hb_bool_constant<true || sizeof (T::min_size)>> : hb_integral_constant<unsigned, T::null_size> {};
struct _hb_null_size<T, hb_void_t<decltype (T::min_size)>> : hb_integral_constant<unsigned, T::null_size> {};
template <typename T>
using hb_null_size = _hb_null_size<T, hb_true_type>;
using hb_null_size = _hb_null_size<T, void>;
#define hb_null_size(T) hb_null_size<T>::value
/* These doesn't belong here, but since is copy/paste from above, put it here. */
@ -60,12 +60,12 @@ using hb_null_size = _hb_null_size<T, hb_true_type>;
/* hb_static_size (T)
* Returns T::static_size if T::min_size is defined, or sizeof (T) otherwise. */
template <typename T, typename B>
template <typename T, typename>
struct _hb_static_size : hb_integral_constant<unsigned, sizeof (T)> {};
template <typename T>
struct _hb_static_size<T, hb_bool_constant<true || sizeof (T::min_size)>> : hb_integral_constant<unsigned, T::static_size> {};
struct _hb_static_size<T, hb_void_t<decltype (T::min_size)>> : hb_integral_constant<unsigned, T::static_size> {};
template <typename T>
using hb_static_size = _hb_static_size<T, hb_true_type>;
using hb_static_size = _hb_static_size<T, void>;
#define hb_static_size(T) hb_static_size<T>::value