Skip to content
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

Add overloads for more key types to ordered_map and fix ordered_map::erase(first, last) with first == last #3564

Merged
merged 3 commits into from
Jul 4, 2022

Conversation

falbrechtskirchinger
Copy link
Contributor

Add the overloads we missed in the string_view PR to ordered_map.

The type trait is_usable_as_key_type (introduced in the string_view PR) was refactored into is_usable_as_basic_json_key_type (equivalent to is_usable_as_key_type before the PR), and is_usable_as_key_type, which now accepts a comparator and key type directly. No functional change is intended.

Extending the element_access2 unit test to also cover ordered_json revealed a bug in ordered_map that is also fixed by this patch.

Fixes #3558.

Add overloads to accept additional key types defined by type trait
detail::is_usable_as_key_type to ordered_map.
The same key types that can be used with json can now also be used with
ordered_json.
@coveralls
Copy link

coveralls commented Jun 29, 2022

Coverage Status

Coverage remained the same at 100.0% when pulling ab47d01 on falbrechtskirchinger:ordered_map into 954b10a on nlohmann:develop.

Copy link
Owner

@nlohmann nlohmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@nlohmann
Copy link
Owner

nlohmann commented Jul 4, 2022

Thanks a lot!

@nlohmann nlohmann merged commit 7d361ec into nlohmann:develop Jul 4, 2022
@falbrechtskirchinger falbrechtskirchinger deleted the ordered_map branch July 4, 2022 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ordered_json doesn't accept keys of types other than string_t (e.g., string_view)
4 participants