148 Commits

Author SHA1 Message Date
Tessil
bd14e6830a Bump version to 1.4.1 v1.4.1 2025-11-02 19:06:06 +00:00
Tessil
b433189817 Update cmake_minimum_required to 3.10 2025-11-02 18:18:03 +00:00
Tessil
eca0de7942 Update Windows and MacOS CI to latest version 2025-11-02 18:11:13 +00:00
Tessil
4ec1bf19c6 Update version to 1.4.0 v1.4.0 2025-03-30 14:39:10 +01:00
Tessil
054ec5ad67 Add a CMake TSL_ROBIN_MAP_ENABLE_INSTALL option to explicitly enable/disable the install target 2025-03-16 17:22:37 +00:00
Jaroslav Ryba
612c2be389 Fix load threshold on deserialization
The current version computes load using max_load_factor() without first
setting m_bucket_count (default 0) leading to threshold 0, which
triggers rehash (and size increase) on first insert.

Recompute the threshold after setting correct bucket count to avoid
this.
2025-02-02 16:21:59 +00:00
Tessil
fe845fd785 Use inline constexpr for PRIMES and MOD_PRIME arrays 2024-09-22 11:23:02 +01:00
Tessil
55c5b0aab2 Move to C++17 dropping C++11 support 2024-09-15 18:32:18 +01:00
Tessil
2c48a1a502 Use macOS 13 in CI 2024-08-26 19:38:45 +01:00
Jose Luis Blanco-Claraco
1115dad3ff Bump cmake_minimum_required version to 3.5 (#77) 2024-05-06 11:25:00 +00:00
Tessil
188c45569c Update version to 1.3.0 v1.3.0 2024-04-19 20:21:18 +01:00
Wenzel Jakob
149ff4590f Add `robin_map/set::erase_fast()` method (fixes #75) (#76)
This commit introduces a new method ``void erase_fast(iterator)`` to both
set and map classes resembling the existing ``iterator
erase(iterator)``.

The main difference is that it does _not_ return an iterator, which is
useful to avoid a performance pitfall explained in issue #75.
2024-04-19 07:18:13 +00:00
Tessil
048eb1442a Update version to 1.2.2 v1.2.2 2024-03-19 21:37:52 +01:00
Tessil
b5009d2c2e Apply clang-format 2024-03-19 21:21:41 +01:00
Tessil
cbc0538158 Add .clang-format file 2024-03-19 21:21:32 +01:00
Wenzel Jakob
918f6647ff Specify library version & versioning rules in headers 2024-03-19 20:05:02 +00:00
Tessil
f45ebce73b Update CI 2023-12-07 07:54:36 +00:00
Tessil
5eace6f74c Fix build error due to missing semicolon 2023-09-25 07:35:52 +01:00
Milian Wolff
0430aee4df Mark error_message in numeric_cast as unused
In a release build without assertions or exceptions
enabled, `TSL_RH_THROW_OR_TERMINATE` is essentially a no-op
and we get a compiler warning that the error_message is unused:

```
In file included from .../robin-map/include/tsl/robin_map.h:34:
.../robin-map/include/tsl/robin_hash.h:77:35: warning: unused parameter 'error_message' [-Wunused-parameter]
                      const char* error_message = "numeric_cast() failed.") {
                                  ^
1 warning generated
```

Fix this by adding a `TSL_RH_UNUSED` for the error message here.
In C++17, the `[[maybe_unused]]` should be used instead.
2023-09-16 18:31:36 +01:00
Tessil
851a59e0e3 Remove compatibility with CMake < 3.3 2023-03-31 16:35:41 +01:00
Tessil
d37a41003b Update CMake tsl-robin-map to v1.2.1 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.
v1.2.0
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 v1.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 v1.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