From ca4f56bdc746d3d23f46898bd83c1b2c3d8250a1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 13 Jan 2022 11:48:34 -0700 Subject: [PATCH] [map] Massage some more Towards being able to store arbitrary types. --- src/hb-map.hh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hb-map.hh b/src/hb-map.hh index 6937a4ab5..8bb9b1c15 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -41,8 +41,8 @@ template ::value ? hb_int_min (V) : (V) -1> struct hb_hashmap_t { - static constexpr K INVALID_KEY = kINVALID; - static constexpr V INVALID_VALUE = vINVALID; + static constexpr k_invalid_t INVALID_KEY = kINVALID; + static constexpr v_invalid_t INVALID_VALUE = vINVALID; hb_hashmap_t () { init (); } ~hb_hashmap_t () { fini (); } @@ -200,14 +200,14 @@ struct hb_hashmap_t void del (K key) { set (key, vINVALID); } /* Has interface. */ - static constexpr V SENTINEL = vINVALID; typedef V value_t; value_t operator [] (K k) const { return get (k); } bool has (K k, V *vp = nullptr) const { V v = (*this)[k]; if (vp) *vp = v; - return v != SENTINEL; + const V vinv = vINVALID; + return v != vinv; } /* Projection. */ V operator () (K k) const { return get (k); }