Commit Graph

128 Commits

Author SHA1 Message Date
Tessil
d37a41003b Update CMake tsl-robin-map to v1.2.1 2023-01-05 23:07:42 +00:00
Tessil
68ff7325b3 Keep rehashing if dist_from_ideal_bucket is > DIST_FROM_IDEAL_BUCKET_LIMIT during insertion (fix issue #52)
During insertion a check was done on dist_from_ideal_bucket to be sure
it doesn't becomes bigger than DIST_FROM_IDEAL_BUCKET_LIMIT but this was
only done during the robin swap. A check should also be done beforehand
if we find an empty bucket otherwise the variable could overflow and
lead to bugs. This commit adds this check.
2023-01-03 20:53:17 +00:00
Thibaut Goetghebuer-Planchon
6775231bbf
Disable CMake install rule if robin_map is used as subproject (#60) 2022-12-18 18:18:01 +00:00
Thibaut Goetghebuer-Planchon
57c9b65e51
Replace depecrated std::aligned_storage since C++23 by alignas (#61) 2022-12-18 18:17:31 +00:00
Tessil
d3131e44bb Raise DIST_FROM_IDEAL_BUCKET_LIMIT to 8192 2022-12-18 18:09:49 +00:00
Tessil
f8e0f679d2 Add assertion to make sure that static_empty_bucket_ptr is empty 2022-06-13 20:03:39 +01:00
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
Thibaut Goetghebuer-Planchon
c77f80b1b3
Update link to Conan package 2022-05-17 22:21:42 +00: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
59a3b7d26d Fix test_extreme_bucket_count_value_construction test on some platforms
Both std::bad_alloc or std::length_error excpetions can be thrown depending on the platform memory overcommit behaviour and total memory
2022-04-17 19:33:17 +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
Thibaut Goetghebuer-Planchon
784245b497
Bump version to 1.0.1 2022-04-05 17:54:26 +00:00
Tessil
e5775ad98b For the tests, force the usage of the Boost static libraries by setting Boost_USE_STATIC_LIBS to ON in CMake 2022-04-03 17:51:00 +01:00
Thibaut Goetghebuer-Planchon
3050179f2a
Bump version to 1.0.0 2022-03-25 14:21:42 +00:00
Tessil
cb212477a0 Remove working-directory in GitHub Actions CI and use absolute path 2022-03-24 20:50:26 +00:00
Thibaut Goetghebuer-Planchon
07bcdef250
Update README.md with GitHub Actions status badge instead of Travis and AppVeyor 2022-03-24 14:10:40 +00:00
Tessil
5b7010b696 Fix Coverage step condition in GitHub Action 2022-03-24 14:00:10 +00:00
Tessil
21bf2c1884 Add MSVC to GitHub Actions CI and remove AppVeyor 2022-03-24 13:54:19 +00:00
Tessil
38ace2fcd9 Use static linking instead of dynamic linking for Boost.Test 2022-03-24 13:49:40 +00:00
Tessil
9775e6a5fc Rename GitHub Actions workflow from CMake to CI 2022-02-28 19:17:56 +00:00
Tessil
50d93360ae Replace Travis by GitHub Actions 2022-02-28 19:10:30 +00:00
Tessil
e6229e1bce Create a local tsl-robin-mapTargets.cmake to fix issue #45
With this local Targets file the CMake binary directory can be passed to find_package without needing an installation.

Example:
find_package(tsl-robin-map PATHS "/home/user/robin-map/build")
if (tsl-robin-map_FOUND)
    target_link_libraries(my_project PRIVATE tsl::robin_map)
endif()
2022-02-27 17:05:43 +00:00
Tessil
228883d21e Fix CMake warning by specifying a project language before including GNUInstallDirs 2022-02-27 16:58:24 +00: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
622443f405 Bump version to 0.6.3. 2020-06-22 06:03:29 +01:00
Tessil
5cf53c6f5d Fix typos. 2020-05-17 13:34:01 +01:00
Tessil
123d530c27 Fix test so that it works no matter the hash function. 2020-05-17 12:19:33 +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
922365f318 Disable code coverage status of codecov. 2020-04-11 15:23:15 +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
Thibaut G
908ccf9f03
Bump version to 0.6.2 2019-09-25 22:20:01 +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
8d650f9a01 Add copy constructor and operator test with an empty map. 2019-08-22 19:24:58 +02:00
Tessil
1105d4b500 Add tests compiled with -fno-exceptions in Travis. 2019-08-15 22:31:30 +02:00