dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.98k stars 4.66k forks source link

Proposal: Span<T>.Sort Extensions #23834

Closed benaadams closed 4 years ago

benaadams commented 6 years ago

Span.Sort Extensions

public static class SpanExtensions
{
    public static void Sort<T>(this Span<T> span) where T : IComparable<T> { } 
    public static void Sort<T>(this Span<T> span, Collections.Generic.IComparer<T> comparer) { } 
    public static void Sort<T>(this Span<T> span, Comparison<T> comparison) { } 
}

Notes:

e.g.

public static void Sort(this Span<byte> span) { } 
public static void Sort(this Span<MyType> span) { } 

Mentioned in api review for array sort https://github.com/dotnet/apireviews/blob/master/2017/10-10-GitHub%20issues.md

/cc @stephentoub @KrzysztofCwalina @terrajobst @karelz

karelz commented 6 years ago

@benaadams is it on Array type? Never mind, I see the title now. Can you please include the type name in the proposal to clarify it?

ektrah commented 6 years ago

Duplicate of dotnet/runtime#19969

benaadams commented 6 years ago

And already approved! 😄

That was fast 😆