From 0ff7954f9f09f80654ac91c16712154744a0dd2d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 10 May 2019 22:04:40 -0700 Subject: [PATCH] [meta] Add hb_is_trivial --- src/hb-meta.hh | 7 +++++++ src/test-meta.cc | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/hb-meta.hh b/src/hb-meta.hh index a1e93d75..df8ebd17 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 f03be306..ffd360b0 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; -- GitLab