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

Sorting with multiple SortComparator uses a Sequence instead of Collection #874

Open
james-kwong opened this issue Aug 18, 2024 · 0 comments

Comments

@james-kwong
Copy link

I see there is a function to sort a Sequence of elements using any Sequence of SortComparator here:

https://github.com/apple/swift-foundation/blob/main/Sources/FoundationEssentials/SortComparator.swift#L234

However, shouldn't the sequence of sort comparators being passed to sorted be of type Collection instead? Because a Sequence doesn't mandate the ability to iterate non-destructively, but the sorted function iterates through the provided Sequence multiple times.

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

No branches or pull requests

1 participant