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 get_or_init for hashmap #1347

Merged
merged 3 commits into from
Dec 23, 2024
Merged

add get_or_init for hashmap #1347

merged 3 commits into from
Dec 23, 2024

Conversation

hackwaly
Copy link
Contributor

Closes #1344

This PR introduce @hashmap.T::get_or_init. It's signature slightly different from linked_hashmap.T::get_or_init. Which init parameter is a function takes key as argument. linked_hashmap.T::get_or_init doesn't.

There's no safe way to migrate get_or_init from old signature to new signature. Maybe introduce a new name get_or_add?

@coveralls
Copy link
Collaborator

coveralls commented Dec 20, 2024

Pull Request Test Coverage Report for Build 4289

Details

  • 1 of 4 (25.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.04%) to 81.198%

Changes Missing Coverage Covered Lines Changed/Added Lines %
hashmap/hashmap.mbt 1 4 25.0%
Totals Coverage Status
Change from base Build 4288: -0.04%
Covered Lines: 4608
Relevant Lines: 5675

💛 - Coveralls

@hackwaly hackwaly force-pushed the yuxiang/hashmap-get-or-init branch from 40162fc to e40bf50 Compare December 23, 2024 03:44
@hackwaly hackwaly requested a review from bobzhang December 23, 2024 03:49
@hackwaly hackwaly force-pushed the yuxiang/hashmap-get-or-init branch from df8ce39 to dbf8af4 Compare December 23, 2024 03:54
@bobzhang bobzhang enabled auto-merge (rebase) December 23, 2024 07:44
@bobzhang bobzhang merged commit c234aaf into main Dec 23, 2024
13 checks passed
@bobzhang bobzhang deleted the yuxiang/hashmap-get-or-init branch December 23, 2024 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing get_or_init for hashmap.T
3 participants