-
Notifications
You must be signed in to change notification settings - Fork 1.6k
<flat_meow>: Don't do extra work in count(), contains(), and equal_range()
#5994
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
Merged
StephanTLavavej
merged 12 commits into
microsoft:feature/flat_map
from
vmichal:flat-meow-optimize-lookup
Jan 8, 2026
Merged
<flat_meow>: Don't do extra work in count(), contains(), and equal_range()
#5994
StephanTLavavej
merged 12 commits into
microsoft:feature/flat_map
from
vmichal:flat-meow-optimize-lookup
Jan 8, 2026
+141
−45
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ull iterators for flat_map.
…hint is incorrect (Don't do extra work).
…atisfy strict_weak_order
…rs when generic key is not key_type.
StephanTLavavej
approved these changes
Jan 8, 2026
Member
🎉 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please note that there is some ongoing conversation and unanswered questions in #5992, so this is likely not the final state of this PR.
Optimize lookups in non-multi containers:
count()is the same ascontains()when searched key is not genericOptimize
equal_range()when its length is at most one and searched key is not genericDon't construct full key-value iterators in
contains()Delay construction of full key-value iterators in
_Flat_map_base::_Find()Shrink bounds for binary search in
_Flat_map_base::_Emplace_hintIntroduce helper
_Flat_map_base::_Iterator_from_key_iteratorfor simpler conversionkey_container_type::(const_)iterator->flat_map::(const_)iteratorReplace all calls to
_RANGES::lower_boundand similar with_STDversions (see discussion https://discord.com/channels/737189251069771789/832305953562427513/1458509280184369246)Resolves #5992