[cplusplus] Internally allow using hb_unique_ptr with hb_free()

...for arbitrary types.
This commit is contained in:
Behdad Esfahbod 2022-06-05 07:52:51 -06:00
parent f18eb000d3
commit b5f621b08d
1 changed files with 14 additions and 1 deletions

View File

@ -466,10 +466,23 @@ static_assert ((sizeof (hb_mask_t) == 4), "");
static_assert ((sizeof (hb_var_int_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 <typename T>
struct vtable
{
static constexpr auto destroy = hb_free;
};
}
/* Headers we include for everyone. Keep topologically sorted by dependency. /* Headers we include for everyone. Keep topologically sorted by dependency.
* They express dependency amongst themselves, but no other file should include * They express dependency amongst themselves, but no other file should include
* them directly.*/ * them directly.*/
#include "hb-cplusplus.hh"
#include "hb-meta.hh" #include "hb-meta.hh"
#include "hb-mutex.hh" #include "hb-mutex.hh"
#include "hb-number.hh" #include "hb-number.hh"