271 Commits

Author SHA1 Message Date
Chris Elrod
e18c09d870 Define doThrow and use abort in case of no exceptions 2023-01-23 22:05:24 +01:00
Chris Elrod
81c5b32f6e Steal robin hood's method of checking for exceptions 2023-01-23 22:05:24 +01:00
chriselrod
3290141626 Define ANKERL_UNORDERED_DENSE_EXCEPTIONS. 2023-01-23 22:05:24 +01:00
Chris Elrod
e95bc32262 use assert instead of branch + throw if __EXCEPTIONS is not defined. 2023-01-23 22:05:24 +01:00
Martin Leitner-Ankerl
612f2b5b2a bump version to 3.0.2 for libc++ pmr fix
Also fix clang-format
v3.0.2
2023-01-07 10:20:09 +01:00
Justus Ranvier
2d8a192afe add libc++ compatibility by checking for <experimental/memory_resource>
Until LLVM 16 is released, and until Android and Apple platforms
incorporate the forthcoming std::pmr support in their forks of libc++,
this workaround is needed to use pmr containers on those platforms.
2023-01-07 10:09:32 +01:00
Martin Leitner-Ankerl
db893958f3 fix clang-format incompatibility v3.0.1 2023-01-06 07:25:28 +01:00
Martin Leitner-Ankerl
2fe91febb0 bump version to 3.0.1 for deallocation with nullptr bugfix 2023-01-06 07:25:28 +01:00
Martin Leitner-Ankerl
34498d66fc Fix deallocation with nullptr in some cases
When map is moved or never initialized, destructor called deallocate with nullptr.
2023-01-06 07:25:28 +01:00
Martin Leitner-Ankerl
6f6cce0264 bump version to 3.0.0 due to incompatible API change for set
Due to iterator -> const_iterator
v3.0.0
2022-12-17 17:38:56 +01:00
Martin Leitner-Ankerl
875f6d269b unordered_dense::set: iterator is now const_iterator
Note that pointer and reference are still as before. This is the same
as for std::unordered_set.
2022-12-17 17:38:56 +01:00
Martin Leitner-Ankerl
252a6c6b75 ditch robin_hood in tests, it's not liked by clang++15's warnings 2022-12-17 17:38:56 +01:00
Martin Leitner-Ankerl
39322aeb0e Make mapped_type only available for map, not for set
This should help e.g. serializers who want to distinguish between map and set by checking for mapped_type. Also, it's more correct.
v2.0.2
2022-12-07 06:18:15 +01:00
Martin Leitner-Ankerl
2cb4414a1d Bump version to 2.0.1 v2.0.1 2022-11-20 13:12:01 +01:00
Martin Leitner-Ankerl
bf7336568f Use reserve() in table's constructor
Also make it work when the underlying container doesn't have a reserve(), e.g. for std::deque.
2022-11-20 10:08:06 +01:00
Huang Rui
16585e3c8c CMakeLists.txt: fix .cmake install path for better compatibility
In some modern build processes, some tools (e.g. vcpkg) do not
display the names under /usr/share/unordered_dense/cmake
correctly, but /usr/lib64/cmake/unordered_dense works fine.

Signed-off-by: Huang Rui <vowstar@gmail.com>
2022-11-04 07:02:51 +01:00
Martin Leitner-Ankerl
a7ece061e8 Fix constructors for custom container
Previously I (wrongly) used containers for the construction of maps when
a custom container was specified. That's not really how it is intended,
the parameter should still be an allocator.

This fixes that issues, so now its possible to copy/move etc. maps when
a custom container is used. That container needs the constructors that
accept an allocator.

I had to bump version by a major number to 2.0.0 because this is an
incompatible API change.
v2.0.0
2022-10-08 08:10:03 +02:00
Martin Leitner-Ankerl
0304ad3345 minor wording "heterogeneous" 2022-10-03 08:19:03 +02:00
Martin Leitner-Ankerl
642964180d Update README.md with better Heterogenous lookup description 2022-10-03 07:23:03 +02:00
Martin Leitner-Ankerl
731e4ca626 bump version to 1.4.0 v1.4.0 2022-10-03 06:55:49 +02:00
Martin Leitner-Ankerl
75f3bf8715 Support heterogeneous C++26 overloads
Implements heterogeneous overloads for various additional methods.
Previously, only "P1690R1 Refinement Proposal for P0919 Heterogeneous
lookup for unordered containers" was implemented.

This adds overloads for map:

* try_emplace
* insert_or_assign
* operator[]
* at

and for set:

* insert
* Additionally, emplace() was updated too to work too.
2022-10-03 06:55:49 +02:00
Martin Leitner-Ankerl
a3cee713bf fix: change contains() return type from size_to to bool
Also bumps version to 1.3.3
v1.3.3
2022-09-24 18:08:28 +02:00
Martin Leitner-Ankerl
d0cc4f22a1 Document heterogenous lookup using is_transparent
Now with documentation in README.md. Also updated transparent.cpp example
and improved tests
2022-09-21 14:54:49 +02:00
Martin Leitner-Ankerl
dae346dc10 fixes is_avalanching default, adds documentation for hashing
Removes is_avalanching from default implementation that uses std::hash.
That would inherit the is_avalanching when the user creates a specialization.

Adds an example test with custom hashes.

Describes hashing in the README.md in a special section, with examples
v1.3.2
2022-09-17 14:23:32 +02:00
Martin Leitner-Ankerl
1371371fbc Fixes deallocation of nullptr bucket v1.3.1 2022-09-08 11:53:50 +02:00
Martin Leitner-Ankerl
e1088b3655 add versioning namespace with a test 2022-09-01 13:51:42 +02:00
Martin Leitner-Ankerl
9673aa5023 Enable consistent .clang-tidy style style, fix all style warnings
Now mostly everything is lower_snake_case.
2022-08-26 19:03:17 +02:00
Martin Leitner-Ankerl
803a0d36e3 fix #10 with a little readme about debugging 2022-08-24 09:22:51 +02:00
Martin Leitner-Ankerl
4676eb91ec Merge pull request #22 from martinus/2022-08-documentation-updates
Add replace(), cmake updates, documentation updates
v1.3.0
2022-08-24 09:12:05 +02:00
Martin Leitner-Ankerl
5a560be1fc bump version to 1.3.0 2022-08-24 08:21:21 +02:00
Martin Leitner-Ankerl
c00233c8f1 Updated README.md
Now with description for
* cmake usage
* the new container API
* Custom container types
* bucket API
2022-08-24 08:18:20 +02:00
Martin Leitner-Ankerl
151bc57011 Add clear() when a container is given in the ctor
Bug fix: when the map/set is constructed with a container, make sure
to clear() it. We just want the type, but not any data in it.
2022-08-24 08:17:35 +02:00
Martin Leitner-Ankerl
78338d4979 Implement replace() with fuzzer and add fuzz targets
This adds replace() to replace the whole internally used container.
It only needs to create the indexing container, so this is relatively
performant. Duplicate entries are discarded.
2022-08-24 08:16:38 +02:00
Martin Leitner-Ankerl
52d0d7420d Updated cmake
Makes the library more easy to use and installable.
2022-08-24 08:16:04 +02:00
Martin Leitner-Ankerl
d6dc7759b5 some hash improvements: generate uint64_t instead of size_t 2022-08-20 15:33:33 +02:00
Martin Leitner-Ankerl
277696b8ed some clang-tidy improvements 2022-08-20 14:02:08 +02:00
Martin Leitner-Ankerl
b59979a5f9 updated unique_ptr_fill test 2022-08-16 21:20:33 +02:00
Martin Leitner-Ankerl
8b0c88390b Merge pull request #21 from martinus/2022-08-small-bucket
Plenty of fixes when capacity is reached
2022-08-15 20:42:48 +02:00
Martin Leitner-Ankerl
f4850bd072 Plenty of fixes when capacity is reached
* Fix capacity, rehash issues when bucket gets full
* Make sure uint16_t types work in bucket
* Maximum capacity is now 2^63 for bucket_type::big
* Fix bad hash for 32bit builds
2022-08-15 20:22:09 +02:00
Martin Leitner-Ankerl
1f50c22690 Merge pull request #20 from martinus/2022-07-allocator-or-container
Adds support for custom container instead of only std::vector.
2022-08-15 19:49:02 +02:00
Martin Leitner-Ankerl
565a4862f8 Adds support for custom container instead of only std::vector.
Adds a test that makes use of boost::interprocess. This also uses
fancy pointers, so there are some updates needed to bucket handling.
v1.2.0
2022-08-15 19:45:19 +02:00
Martin Leitner-Ankerl
94156450d9 Merge pull request #17 from martinus/2022-08-custom-bucket-types
2022 08 custom bucket types
v1.1.0
2022-08-02 10:51:13 +02:00
Martin Leitner-Ankerl
b0fbac446a add missing cast 2022-08-01 21:54:42 +02:00
Martin Leitner-Ankerl
101fd7005c for #16: customizable bucket types 2022-08-01 21:50:29 +02:00
Martin Leitner-Ankerl
5c6eb30333 fix build arguments availability 2022-08-01 18:20:04 +02:00
Martin Leitner-Ankerl
a6423a7f96 Change buckets from pointers to indexing
This seems to be a bit faster in my tests
Also, enable & fix a few more compiler warnings.
2022-08-01 07:51:22 +02:00
Martin Leitner-Ankerl
782a055c4f new API: values() and extract() 2022-07-29 14:36:19 +02:00
Martin Leitner-Ankerl
8323fe606c Merge pull request #15 from jcelerier/main
fixes #14: Add a missing reserve() call
2022-07-29 09:53:06 +02:00
Jean-Michaël Celerier
448fec3c03 [fix] Add a missing reserve() call 2022-07-28 23:23:59 +02:00
Martin Leitner-Ankerl
e015525696 make sure benchmarks run long enough 2022-07-23 21:13:31 +02:00