Closed BenjiHansell closed 1 year ago
Thank you for the report.
From a quick test with clang++-14.0.6
and g+-12.2.0
with -O3
using libstdc++
on you provided example I get the expected results:
1
4
annotationId, kind, oldUri, newUri,
1
4
annotationId, kind, oldUri, newUri,
I'll check more in depth when I have some time as your results are quite worrying.
In case it helps, I've managed to create a better reproduction which fails on every platform I've tried it on:
tsl::ordered_set<std::size_t, IdentityHash> foo;
foo.emplace(1657314675755591361ull);
foo.emplace(8148226713986838624ull);
foo.insert_at_position(foo.begin(), 17991626144733246576ull);
std::cout << foo.count(1657314675755591361ull); // always prints 0
where
struct IdentityHash {
std::size_t operator()(std::size_t x) const { return x; }
};
that fails on
On at least some of those I've tested with and without NDEBUG and with varied optimisation levels. So I'm pretty sure this version will reproduce on any compiler or standard library you care to try.
Thank you very much for the example.
I was able to reproduce the error and pushed a fix. Both insert_at_position
and erase
are affected (not unordered_erase
and pop_back
). Could you try it out?
I'll check to add some extra tests later.
I merged the PR and created a new release. Thanks for the help.
I will close the issue. Let me know if you encounter any problem and I can reopen it.
Many thanks for the speedy fix. It works on my end too.
Firstly, thank you @Tessil for your selection brilliant open source hash tables.
An example of my issue would be:
Making further calls on the same set reveals that the "kind" key is actually present:
And we can even get a duplicate key to appear in the map:
That is with
Apple clang version 14.0.0 (clang-1400.0.29.202)
using libc++.ordered-map version: 1.0.0