[map] Another try at hiding minus1

To fix https://github.com/harfbuzz/harfbuzz/issues/3684
This commit is contained in:
Behdad Esfahbod 2022-06-27 13:29:22 -06:00
parent c72d3104ed
commit 5da341ce92
2 changed files with 10 additions and 1 deletions

View File

@ -34,6 +34,8 @@
* hb_hashmap_t
*/
extern HB_INTERNAL const hb_codepoint_t minus_1;
template <typename K, typename V,
bool minus_one = false>
struct hb_hashmap_t
@ -80,7 +82,11 @@ struct hb_hashmap_t
static inline const V& default_value () { return Null(V); };
template <bool v = minus_one,
hb_enable_if (v == true)>
static inline const V& default_value () { static const V minus_1 = -1; return minus_1; };
static inline const V& default_value ()
{
static_assert (hb_is_same (V, hb_codepoint_t), "");
return minus_1;
};
void clear ()
{

View File

@ -53,6 +53,9 @@ DEFINE_NULL_NAMESPACE_BYTES (AAT, SettingName) = {0xFF,0xFF, 0xFF,0xFF};
const unsigned char _hb_Null_AAT_Lookup[2] = {0xFF, 0xFF};
/* hb_map_t */
const hb_codepoint_t minus_1 = -1;
/* hb_face_t */