[map] Remove invalid-key template arguments since unused

This commit is contained in:
Behdad Esfahbod 2022-06-02 10:43:36 -06:00
parent 3f6a8f69a0
commit 0ccab339f9
4 changed files with 15 additions and 22 deletions

View File

@ -35,9 +35,7 @@
*/
template <typename K, typename V,
typename k_invalid_t = K,
typename v_invalid_t = V,
k_invalid_t kINVALID = std::is_pointer<K>::value ? 0 : std::is_signed<K>::value ? hb_int_min (K) : (K) -1,
v_invalid_t vINVALID = std::is_pointer<V>::value ? 0 : std::is_signed<V>::value ? hb_int_min (V) : (V) -1>
struct hb_hashmap_t
{
@ -401,15 +399,11 @@ struct hb_hashmap_t
struct hb_map_t : hb_hashmap_t<hb_codepoint_t,
hb_codepoint_t,
hb_codepoint_t,
hb_codepoint_t,
HB_MAP_VALUE_INVALID,
HB_MAP_VALUE_INVALID>
{
using hashmap = hb_hashmap_t<hb_codepoint_t,
hb_codepoint_t,
hb_codepoint_t,
hb_codepoint_t,
HB_MAP_VALUE_INVALID,
HB_MAP_VALUE_INVALID>;
~hb_map_t () = default;

View File

@ -78,7 +78,7 @@ HB_INTERNAL bool postV2Tail::subset (hb_subset_context_t *c) const
post::accelerator_t _post (c->plan->source);
hb_hashmap_t<hb_bytes_t, unsigned, std::nullptr_t, unsigned, nullptr, (unsigned)-1> glyph_name_to_new_index;
hb_hashmap_t<hb_bytes_t, unsigned> glyph_name_to_new_index;
for (hb_codepoint_t new_gid = 0; new_gid < num_glyphs; new_gid++)
{
hb_codepoint_t old_gid = reverse_glyph_map.get (new_gid);

View File

@ -720,8 +720,7 @@ struct hb_serialize_context_t
/* Map view of packed objects. */
hb_hashmap_t<const object_t *, objidx_t,
const object_t *, objidx_t,
nullptr, 0> packed_map;
objidx_t, 0> packed_map;
};
#endif /* HB_SERIALIZE_HH */

View File

@ -127,19 +127,19 @@ main (int argc, char **argv)
/* Test class key / value types. */
{
hb_hashmap_t<hb_bytes_t, int, std::nullptr_t, int, nullptr, 0> m1;
hb_hashmap_t<int, hb_bytes_t, int, std::nullptr_t, 0, nullptr> m2;
hb_hashmap_t<hb_bytes_t, hb_bytes_t, std::nullptr_t, std::nullptr_t, nullptr, nullptr> m3;
hb_hashmap_t<hb_bytes_t, int, int, 0> m1;
hb_hashmap_t<int, hb_bytes_t, std::nullptr_t, nullptr> m2;
hb_hashmap_t<hb_bytes_t, hb_bytes_t, std::nullptr_t, nullptr> m3;
assert (m1.get_population () == 0);
assert (m2.get_population () == 0);
assert (m3.get_population () == 0);
}
{
hb_hashmap_t<int, int, int, int, 0, 0> m0;
hb_hashmap_t<std::string, int, const std::string*, int, &invalid, 0> m1;
hb_hashmap_t<int, std::string, int, const std::string*, 0, &invalid> m2;
hb_hashmap_t<std::string, std::string, const std::string*, const std::string*, &invalid, &invalid> m3;
hb_hashmap_t<int, int, int, 0> m0;
hb_hashmap_t<std::string, int, int, 0> m1;
hb_hashmap_t<int, std::string, const std::string*, &invalid> m2;
hb_hashmap_t<std::string, std::string, const std::string*, &invalid> m3;
std::string s;
for (unsigned i = 1; i < 1000; i++)
@ -156,8 +156,8 @@ main (int argc, char **argv)
{
using pair = hb_pair_t<hb_codepoint_t, hb_codepoint_t>;
hb_hashmap_t<hb_map_t, hb_map_t, const hb_map_t *, const hb_map_t *, &invalid_map, &invalid_map> m1;
hb_hashmap_t<hb_map_t, hb_map_t, std::nullptr_t, std::nullptr_t, nullptr, nullptr> m2;
hb_hashmap_t<hb_map_t, hb_map_t, const hb_map_t *, &invalid_map> m1;
hb_hashmap_t<hb_map_t, hb_map_t, std::nullptr_t, nullptr> m2;
m1.set (hb_map_t (), hb_map_t {});
m2.set (hb_map_t (), hb_map_t {});
@ -177,8 +177,8 @@ main (int argc, char **argv)
/* Test hashing sets. */
{
hb_hashmap_t<hb_set_t, hb_set_t, const hb_set_t *, const hb_set_t *, &invalid_set, &invalid_set> m1;
hb_hashmap_t<hb_set_t, hb_set_t, std::nullptr_t, std::nullptr_t, nullptr, nullptr> m2;
hb_hashmap_t<hb_set_t, hb_set_t, const hb_set_t *, &invalid_set> m1;
hb_hashmap_t<hb_set_t, hb_set_t, std::nullptr_t, nullptr> m2;
m1.set (hb_set_t (), hb_set_t ());
m2.set (hb_set_t (), hb_set_t ());
@ -200,8 +200,8 @@ main (int argc, char **argv)
{
using vector_t = hb_vector_t<unsigned>;
hb_hashmap_t<vector_t, vector_t, const vector_t *, const vector_t *, &invalid_vector, &invalid_vector> m1;
hb_hashmap_t<vector_t, vector_t, std::nullptr_t, std::nullptr_t, nullptr, nullptr> m2;
hb_hashmap_t<vector_t, vector_t, const vector_t *, &invalid_vector> m1;
hb_hashmap_t<vector_t, vector_t, std::nullptr_t, nullptr> m2;
m1.set (vector_t (), vector_t ());
m2.set (vector_t (), vector_t ());