From b5f621b08d56c15832ab4f588a0673fce03305a0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 5 Jun 2022 07:52:51 -0600 Subject: [PATCH] [cplusplus] Internally allow using hb_unique_ptr with hb_free() ...for arbitrary types. --- src/hb.hh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/hb.hh b/src/hb.hh index 14872e2a4..b96a1b735 100644 --- a/src/hb.hh +++ b/src/hb.hh @@ -466,10 +466,23 @@ static_assert ((sizeof (hb_mask_t) == 4), ""); static_assert ((sizeof (hb_var_int_t) == 4), ""); +#include "hb-cplusplus.hh" + +namespace hb { + +// Allow using hb::unique_ptr with hb_free() internally. +template +struct vtable +{ + static constexpr auto destroy = hb_free; +}; + +} + + /* Headers we include for everyone. Keep topologically sorted by dependency. * They express dependency amongst themselves, but no other file should include * them directly.*/ -#include "hb-cplusplus.hh" #include "hb-meta.hh" #include "hb-mutex.hh" #include "hb-number.hh"