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

Unsafe[Mutable]BufferPointer should provide indices and/or forEach even when Element: ~Copyable #76509

Open
grynspan opened this issue Sep 17, 2024 · 2 comments
Labels
feature A feature request or implementation move-only Feature → type declarations: Move-only type declarations standard library Area: Standard library umbrella triage needed This issue needs more specific labels

Comments

@grynspan
Copy link
Contributor

Motivation

It's a pain in the patella to iterate over a buffer pointer containing non-copyable values. Seems like indices and/or a borrowing forEach(_:) ought to be possible to implement even for non-copyable values.

Proposed solution

Implement indices and forEach(_:) when Self doesn't conform to Sequence or Collection.

Alternatives considered

There's probably a dozen other ways to accomplish iteration here that would be concise and "Swifty".

Additional information

No response

@grynspan grynspan added feature A feature request or implementation standard library Area: Standard library umbrella triage needed This issue needs more specific labels move-only Feature → type declarations: Move-only type declarations labels Sep 17, 2024
@stephentyrone
Copy link
Contributor

This is really a sub-task of "design protocols and language integration that support containers of ~Copyable", which @lorentey has been working on. I don't think we need a separate issue tracking it, but I'll let Karoy figure that out.

@grynspan
Copy link
Contributor Author

That's fair. I'm focused right now on the ergonomics of what we do have: is there something smaller we can do to improve them before we get anything resembling full collection type support?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A feature request or implementation move-only Feature → type declarations: Move-only type declarations standard library Area: Standard library umbrella triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

2 participants