Commit Graph

37 Commits

Author SHA1 Message Date
Tessil
ac1e3d8481 Add some extra assertions for clarity and ease of debug 2022-05-21 19:43:40 +01:00
Tessil
f1e7457a71 Clear and shrink the moved hash table in the move operator to be coherent with the move constructor 2022-05-21 19:41:28 +01:00
Tessil
4abcc978b9 When using C++17, std::launder the reinterpreted pointer from std::aligned_storage to adapt to the change of object model introduced in P0137R1. Fix potential undefined behaviour.
C++17 introduced a change in the object model with P0137R1 which now requires the reinterpreted pointer from std::aligned_storage to be laundered. See the following discussion for some details https://stackoverflow.com/questions/47735657/does-reinterpret-casting-stdaligned-storage-to-t-without-stdlaunder-violat
2022-05-21 19:30:50 +01:00
Tessil
c7595ba058 Apply clang-format --style=Google 2022-04-30 09:48:33 +01:00
Tessil
37e94dcdb2 When exceptions are disabled, only print the error message when defined(TSL_DEBUG) instead of !defined(NDEBUG) 2022-04-30 09:48:11 +01:00
Tessil
0c3c8582db Check that bucket_count doesn't exceed max_bucket_count() after the constructor initialization
max_bucket_count() method relies on m_buckets_data which needs to be properly initialized first
2022-04-17 19:06:18 +01:00
Tessil
a24e904455 Fix USE_STORED_HASH_ON_REHASH to return true when bucket_count is 0, STORE_HASH is true and is_power_of_two_policy<GrowthPolicy>::value is true
This commit doesn't change the actual behaviour of the map as even when USE_STORED_HASH_ON_REHASH was returning false on empty map rehashes, no stored hashes were used as the map was empty.
2022-02-27 15:56:13 +00:00
Stainlee Baakhla
a603419b9a
Remove compilation error when -Wshadow flag is set (#41) 2021-02-13 18:25:23 +00:00
Tessil
84c1bee16e Apply clang-format with Google style to the source code 2020-11-08 14:45:57 +00:00
Thibaut Goetghebuer
dc2023b02e
Add support for efficient serialization (#36) 2020-08-23 20:08:51 +01:00
Tessil
997a30d299 Add and use TSL_RH_UNUSED macro. 2020-08-09 18:45:29 +01:00
Tessil
5cf53c6f5d Fix typos. 2020-05-17 13:34:01 +01:00
Tessil
4d1666633e Fix issue #33. The value function of a 'const iterator' can now be called and returns a mutable reference to the underlying 'value_type'. 2020-05-17 12:03:20 +01:00
Tessil
5c6b2e5c55 Fix shrink when min_load_factor is set and a range erase with end() as last is called. The m_try_skrink_on_next_insert was not correctly set. 2020-04-17 19:49:36 +01:00
Tessil
a3451bde49 Reorder the members of robin_hash. 2020-04-13 13:26:09 +01:00
Tessil
c3e86d3935 Add full name in license. 2020-04-11 14:18:31 +01:00
Tessil
f26e2ebb12 Remove erroneous comment. 2020-03-30 21:27:42 +01:00
Tessil
cb6b7cf8c7 Fix issue #31. When 'min_load_factor()' > 0, the 'clear()' method will also reset the 'bucket_count' of the hash table to 0. 2020-03-28 21:07:13 +00:00
Tessil
0e0df6c99a Make static_empty_bucket_ptr() function noexcept for better readability when used in noexcept functions. 2020-03-28 21:02:16 +00:00
Tessil
e4316eb284 Raise the maximum possible size of the hash table when using the prime_growth_policy on a 64-bit platform. Fix issue #26. 2019-10-25 20:00:32 +02:00
Tessil
425a213b17 Add 'bool contains(...)' methods. 2019-09-25 22:02:22 +02:00
Tessil
f66212139c Raise DIST_FROM_IDEAL_BUCKET_LIMIT to 4096. 2019-09-25 21:54:58 +02:00
Tessil
9a3a4f3f27 Fix typo in comment. 2019-09-25 21:46:59 +02:00
Tessil
73959d62e3 Fix issue #23. The 'distance_type' used to store the distance of a value in a bucket from its ideal bucket could overflow when a lot of collisions happened and the load_factor() stayed below REHASH_ON_HIGH_NB_PROBES__MIN_LOAD_FACTOR. We now rehash no matter the load factor if the distance becomes too high. 2019-09-25 20:27:26 +02:00
Tessil
02f526cf1d Add possibility to compile the tests with exceptions disabled. 2019-08-15 22:30:16 +02:00
Tessil
7d079e8cb3 Add information on the copy and/or move constructible requirement of 'Key' and 'T'. 2019-05-18 12:50:05 +02:00
Tessil
580391e689 Add documentation on the 'Swappable' requirement of 'Key' and 'T' (#19). 2019-05-18 12:28:43 +02:00
d44m1n
60a2fe59ab Fix compilation error when exceptions are disabled and C++ 14 or higher is used. (#18) 2019-05-12 23:36:49 +02:00
Thibaut
a27938076c
Add support for min_load_factor (#17). 2019-04-28 18:35:29 +02:00
Thibaut
5d3f52f4ef
Fix compilation error for move-only types with a throwing move constructor/operator. (#14) 2019-02-25 22:16:27 +01:00
Tessil
1855aad969 Rename the internal 'insert' with hint method to 'insert_hint' to avoid a potential ambiguous overload with the 'insert' with a pair of iterators. 2019-02-13 20:01:39 +01:00
Thibaut
10b9ef0a12
Fix compilation error with GCC 9, the implicit copy/move constructor/operator of the iterator were not generated (#12) 2019-02-12 21:55:31 +01:00
Tessil
5e4b5e3a6b Set bucket count for default contructed map/set to 0 to avoid any allocation. 2019-01-20 13:47:03 +01:00
Tessil
8d494bc239 Change error message when max_bucket_count is reached. It's the maximum bucket count that has been reached and not the size. 2019-01-14 21:28:33 +01:00
Tessil
7b73ef9911 Rename some internal variables for better code clarity. 2019-01-13 16:53:30 +01:00
Tessil
cb69fb5016 Use TSL_RH prefix for macros instead of just TSL. 2018-09-17 22:18:19 +02:00
Tessil
29e001269b Move headers from tsl to include/tsl for coherence with other C++ projects. 2018-09-17 21:07:19 +02:00