Add hb_static_size(T)
This commit is contained in:
parent
f99abcc379
commit
39b9d63b01
|
@ -44,6 +44,7 @@
|
|||
/* The hard way...
|
||||
* https://stackoverflow.com/questions/7776448/sfinae-tried-with-bool-gives-compiler-error-template-argument-tvalue-invol
|
||||
*/
|
||||
|
||||
template<bool> struct _hb_bool_type {};
|
||||
|
||||
template <typename T, typename B>
|
||||
|
@ -58,6 +59,24 @@ struct hb_null_size
|
|||
{ enum { value = _hb_null_size<T, _hb_bool_type<true> >::value }; };
|
||||
#define hb_null_size(T) hb_null_size<T>::value
|
||||
|
||||
/* This doesn't belong here, but since is copy/paste from above, put it here. */
|
||||
|
||||
template <typename T, typename B>
|
||||
struct _hb_static_size
|
||||
{ enum { value = sizeof (T) }; };
|
||||
template <typename T>
|
||||
struct _hb_static_size<T, _hb_bool_type<(bool) (1 + (unsigned int) T::min_size)> >
|
||||
{ enum { value = T::static_size }; };
|
||||
|
||||
template <typename T>
|
||||
struct hb_static_size
|
||||
{ enum { value = _hb_static_size<T, _hb_bool_type<true> >::value }; };
|
||||
#define hb_static_size(T) hb_static_size<T>::value
|
||||
|
||||
|
||||
/*
|
||||
* Null()
|
||||
*/
|
||||
extern HB_INTERNAL
|
||||
hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)];
|
||||
|
||||
|
|
Loading…
Reference in New Issue