Behdad Esfahbod
c72d3104ed
[map] Return const reference in operator[]
2022-06-27 13:31:05 -06:00
Behdad Esfahbod
69d53f3e7f
[map] Make default_value() inline
...
See if it make fix https://github.com/harfbuzz/harfbuzz/issues/3684
2022-06-27 13:17:10 -06:00
Behdad Esfahbod
88f00ecb84
[map] Fix iter_ref () and test it
2022-06-03 01:30:27 -06:00
Behdad Esfahbod
25f57230d5
[map] Return references from new iter_ref()
2022-06-03 01:14:35 -06:00
Behdad Esfahbod
997d9cc466
[map] Make unique_ptr hashable
2022-06-02 18:47:42 -06:00
Behdad Esfahbod
8bb2a3326e
[map] Remove unneeded assignment
2022-06-02 15:18:23 -06:00
Behdad Esfahbod
e9407a2bd2
Use shared_ptr<hb_set_t> in one place
...
See if valgrind is happy...
2022-06-02 12:00:43 -06:00
Behdad Esfahbod
b9230c5425
[map] Fix has()
2022-06-02 11:23:38 -06:00
Behdad Esfahbod
97ea10a63a
Remove old nullptr_t hacks
...
Were used for hashmap before.
2022-06-02 11:23:38 -06:00
Behdad Esfahbod
3f78a71ca0
[map] Finally! Just can usd hb_hashmap_t<obj_t, obj_t>
...
Yay!
2022-06-02 11:23:37 -06:00
Behdad Esfahbod
0ccab339f9
[map] Remove invalid-key template arguments since unused
2022-06-02 11:23:37 -06:00
Behdad Esfahbod
3f6a8f69a0
[map] Remove invalid-key special-casing
...
Can override invalid-key value now.
2022-06-02 11:23:37 -06:00
Behdad Esfahbod
5328b73fba
[map] Reduce map item size again
2022-06-02 11:23:37 -06:00
Behdad Esfahbod
4f58ae60eb
[map] Keep is_used, is_tombstone as booleans
2022-06-02 11:23:37 -06:00
Behdad Esfahbod
ea2dd54b68
[map] Place item hash between key and value, not after them
...
This way if only one of key and value is 64bit (eg. pointer), and other is 32bit,
the whole item will fit in 128bit, whereas before it would have been bumped up to
196 if only value was 64bit (a common use-case for us.)
2022-05-30 05:54:20 -06:00
Behdad Esfahbod
cbcdf442c5
[map] Speed up map's own hash()
2022-05-30 05:54:20 -06:00
Behdad Esfahbod
de33ef61b7
[map] Add TODO item
2022-05-30 05:54:20 -06:00
Behdad Esfahbod
b99efa6c8d
[map] Minor: use const reference in has()
2022-05-28 05:16:34 -06:00
Behdad Esfahbod
2fdb7616f5
[map Further adjust hash function
2022-05-19 16:00:43 -06:00
Behdad Esfahbod
01fc90b68c
[map] Adjust hash function
2022-05-19 16:00:06 -06:00
Behdad Esfahbod
58f848daa8
[set/map] Adjust hash function return type
2022-05-19 15:43:19 -06:00
Behdad Esfahbod
561e02fefb
[map] Make hb_map_t hashable
2022-05-19 13:41:53 -06:00
Behdad Esfahbod
ad17699089
[map] Add is_equal() / towards making hb_map_t hashable
...
New API:
+ hb_map_is_equal()
2022-05-19 13:36:12 -06:00
Behdad Esfahbod
f82ee17a75
[map] Pre-size map in constructor if we can
2022-05-18 12:19:49 -06:00
Behdad Esfahbod
7fa580bc4f
[map] Fix map copy/move constructors to actually work
...
Ouch!
2022-05-12 13:05:32 -06:00
Garret Rieger
e30511a8de
[map] Correct previous commit, if (...) was reversed.
2022-01-14 16:48:42 -08:00
Garret Rieger
ff4e8c7eac
[map] Fix bad memory access if hb_map.fini() was called twice.
2022-01-14 16:42:39 -08:00
Behdad Esfahbod
8a69e00639
[meta] Use std::addressof() instead of hb_addressof()
2022-01-13 16:17:34 -07:00
Behdad Esfahbod
47afb3ef04
[meta] Replace hb_is_pointer with std::is_pointer
2022-01-13 15:27:41 -07:00
Behdad Esfahbod
956e0a4d13
[map] Destruct objects
2022-01-13 15:07:10 -07:00
Behdad Esfahbod
985b63b3ee
[map] Allow invalid items to be pointer to static object
...
By derefencing them when necessary.
Also, we do not rely on trivially-copyable, so remove that assertion.
2022-01-13 13:33:07 -07:00
Behdad Esfahbod
5a91db1135
[map] Remove constexpr invalid items
...
These were non-workable in the general case, eg std::string.
2022-01-13 12:44:48 -07:00
Behdad Esfahbod
114046dc27
[map] Construct objects
2022-01-13 12:38:26 -07:00
Behdad Esfahbod
ca4f56bdc7
[map] Massage some more
...
Towards being able to store arbitrary types.
2022-01-13 12:18:59 -07:00
Behdad Esfahbod
74811c501d
[map] Map == / != use correct types
2022-01-12 10:35:28 -07:00
Behdad Esfahbod
ce7f19a2cc
Revert "[map] Actually use k/v invalid types for declaration!"
...
This reverts commit 6f559346ac
.
Err. My bad.
2022-01-10 14:40:27 -07:00
Behdad Esfahbod
6f559346ac
[map] Actually use k/v invalid types for declaration!
2022-01-10 14:29:36 -07:00
Behdad Esfahbod
394f772937
[map] Allow storing classes in the hashmap
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/3293
The trick was to change the type of the invalid key/value to be non-class.
2021-11-19 11:49:23 -07:00
Behdad Esfahbod
b1cd0dce8e
[map] Add INVALID_KEY and INVALID_VALUE
2021-11-02 17:56:11 -06:00
Behdad Esfahbod
59d8f6c817
[map] Fix copy assignment operator
2021-11-02 10:33:53 -06:00
Behdad Esfahbod
943921cf0c
[meta] Use more std type_traits
2021-11-02 00:26:46 -06:00
Behdad Esfahbod
811f80a701
[algs] Use std::move instead of hb_move()
2021-11-02 00:17:54 -06:00
Behdad Esfahbod
4c6fd7cdb2
[map] Try moving items when resizing
2021-11-01 23:13:34 -06:00
Behdad Esfahbod
a28ea8d7f3
Simplify swap()
2021-11-01 22:50:54 -06:00
Behdad Esfahbod
94158316d9
[map] Add iterable constructor
2021-11-01 22:47:26 -06:00
Behdad Esfahbod
a03b9b14c9
[map] Add initializer_list and swap()
2021-11-01 22:45:11 -06:00
Behdad Esfahbod
c30f6834d0
[map] Add 5 methods
2021-11-01 22:29:14 -06:00
Behdad Esfahbod
d3e09bf465
[set] Make all operators null-safe again
...
Changed my mind.
Also for hb_map_clear().
Part of https://github.com/harfbuzz/harfbuzz/pull/3162
2021-08-24 10:31:49 -06:00
Garret Rieger
c08f1b8903
[map] fix incorrect population count in hash map.
...
If the same key was set twice the population was being incorrectly incremented.
2021-08-10 14:00:55 -06:00
Behdad Esfahbod
2337f0d047
Internally use hb_malloc/.../hb_free instead of malloc/.../free
...
Redefining those stock names as macros was conflicting with gcc 10
headers.
Fixes https://github.com/harfbuzz/harfbuzz/issues/3044
2021-07-08 10:54:09 -07:00