Skip to content

Add missing overload to ordered_map::find#5171

Merged
nlohmann merged 4 commits into
developfrom
const_find
May 18, 2026
Merged

Add missing overload to ordered_map::find#5171
nlohmann merged 4 commits into
developfrom
const_find

Conversation

@nlohmann
Copy link
Copy Markdown
Owner

ordered_map provides four lookup variants for emplace, at, count, and the non-const find, but only three variants for const lookup: one exact-key non-const, one template non-const, and one exact-key const. The template const overload is absent:

// present
iterator find(const key_type& key);                    // exact, non-const
iterator find(KeyType&& key);                          // template, non-const  ✓
const_iterator find(const key_type& key) const;        // exact, const         ✓

// MISSING
const_iterator find(KeyType&& key) const;              // template, const      ✗

This PR adds the mission overload and a test.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
@nlohmann nlohmann added the review needed It would be great if someone could review the proposed changes. label May 15, 2026
@github-actions

This comment was marked as outdated.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
@nlohmann nlohmann marked this pull request as draft May 15, 2026 15:03
@nlohmann nlohmann removed the review needed It would be great if someone could review the proposed changes. label May 15, 2026
nlohmann added 2 commits May 18, 2026 15:10
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
@nlohmann nlohmann marked this pull request as ready for review May 18, 2026 14:55
@nlohmann nlohmann added the review needed It would be great if someone could review the proposed changes. label May 18, 2026
@nlohmann nlohmann removed the review needed It would be great if someone could review the proposed changes. label May 18, 2026
@nlohmann nlohmann added this to the Release 3.12.1 milestone May 18, 2026
@nlohmann nlohmann merged commit 47202c8 into develop May 18, 2026
143 checks passed
@nlohmann nlohmann deleted the const_find branch May 18, 2026 18:33
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.

2 participants