-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc++] Implement std::flat_multiset
#128363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
da0281d
to
df09bee
Compare
14b6ee7
to
437a643
Compare
✅ With the latest revision this PR passed the C/C++ code formatter. |
You mean |
std::multiset
std::flat_multiset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch! I have some comments, but once they are addressed I am comfortable with this being merged. I did a less thorough review but I am relying on the fact that this is so similar to the other flat containers that most aspects of this have already been discussed many times.
|
||
if (!__prev_larger && !__next_smaller) [[likely]] { | ||
// hint correct, just use exact hint iterators | ||
} else if (__prev_larger && !__next_smaller) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This behavior is not technically mandated by the standard. Let's add a libc++ specific test to pin down that behavior. I don't care strongly whether we provide that behavior, but if we "break" that in the future I'd at least like for us to notice and make an explicit decision about it.
We should also add a similar test for flat_multimap
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After reading the spec again, i think this behaviour is mandated. We do have tests that test this behaviour.
This paragraph says flat_multiset
meets the requirements of associative containers (with some exceptions)
https://eel.is/c++draft/flat.multiset.overview#2
And associative container's requirement for emplace_hint
is that the insertion location should be as close as the hint.
https://eel.is/c++draft/containers#associative.reqmts.general-58
libcxx/test/std/containers/container.adaptors/flat.multiset/helpers.h
Outdated
Show resolved
Hide resolved
38296c9
to
aeaa29e
Compare
ec2a310
to
1bcb3f6
Compare
fixes #105193