diff --git a/src/hb-meta.hh b/src/hb-meta.hh index a1e93d750ba9efdee41d2535e45be8369cc46afc..df8ebd17503396b1cf96a0e843f0aa03c4a0a331 100644 --- a/src/hb-meta.hh +++ b/src/hb-meta.hh @@ -389,5 +389,12 @@ using hb_is_trivially_copyable= hb_bool_constant< >; #define hb_is_trivially_copyable(T) hb_is_trivially_copyable::value +template +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::value + #endif /* HB_META_HH */ diff --git a/src/test-meta.cc b/src/test-meta.cc index f03be306434c8490925b47d206abd12449d3daf5..ffd360b0d3ce984411a91edf3975db692afc23ae 100644 --- a/src/test-meta.cc +++ b/src/test-meta.cc @@ -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;