8000 Add 1.23 iterators support by errx · Pull Request #4 · kamstrup/intmap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add 1.23 iterators support #4

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
merged 1 commit into from
Nov 30, 2024
Merged

Add 1.23 iterators support #4

merged 1 commit into from
Nov 30, 2024

Conversation

errx
Copy link
@errx errx commented Nov 29, 2024

Hello, I've added support for iterators, method names are taken from https://pkg.go.dev/maps package

Copy link
Owner
@kamstrup kamstrup left a comment

Choose a reason for hiding this comment

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

Hey thanks for your contribution! Just a minor nitpick< 8000 /p>

map64.go Outdated
Comment on lines 337 to 352
func forEach64Keys[K IntKey, V any](pairs []pair[K, V], f func(k K) bool) {
for _, p := range pairs {
if p.K != K(0) && !f(p.K) {
return
}
}
}

func forEach64Values[K IntKey, V any](pairs []pair[K, V], f func(v V) bool) {
for _, p := range pairs {
if p.K != K(0) && !f(p.V) {
return
}
}
}

Copy link
Owner

Choose a reason for hiding this comment

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

Since these 2 functions just have a single call site I would prefer if we just fold them into Keys() and Values()

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the suggestion, done!

Copy link
Owner
@kamstrup kamstrup left a comment

Choose a reason for hiding this comment

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

Great!

@kamstrup kamstrup merged commit 881e963 into kamstrup:main Nov 30, 2024
@kamstrup
Copy link
Owner

Just released 0.5.0 with this new API 👍

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.

2 participants
0