[meta] Add hb_is_trivial

This commit is contained in:
Behdad Esfahbod 2019-05-10 22:04:40 -07:00
parent 7162a97bca
commit 0ff7954f9f
2 changed files with 11 additions and 0 deletions

View File

@ -389,5 +389,12 @@ using hb_is_trivially_copyable= hb_bool_constant<
>;
#define hb_is_trivially_copyable(T) hb_is_trivially_copyable<T>::value
template <typename T>
using hb_is_trivial= hb_bool_constant<
hb_is_trivially_copyable (T) &&
hb_is_trivially_default_constructible (T)
>;
#define hb_is_trivial(T) hb_is_trivial<T>::value
#endif /* HB_META_HH */

View File

@ -119,6 +119,10 @@ main (int argc, char **argv)
static_assert (hb_is_trivially_copyable (X), "");
static_assert (hb_is_trivially_copyable (Y), "");
static_assert (hb_is_trivial (int), "");
static_assert (hb_is_trivial (X), "");
static_assert (hb_is_trivial (Y), "");
/* TODO Add more meaningful tests. */
return 0;