Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SortIndices

Sorts a span of indices by comparing a read-only span of values of type T, using a custom comparer.
Read time 1 minuteLast updated 12 days ago

Definition

  • Type: Method
  • Namespace: Unity.Collections
  • Assembly: UnityEngine.ManagedKernelModule

SortIndices<T, U>(Span<int>, ReadOnlySpan<T>, T)

Sorts a span of indices by comparing a read-only span of values of type T, using a custom comparer.
public static void SortIndices<T, U>(this Span<int> indices, ReadOnlySpan<T> values, U comp) where T : unmanaged, IComparable<T> where U : unmanaged, IComparer<T>

Parameters

indices

Indices to sort. Indices must be unique, nonnegative, and strictly less than the length of values.

Values to use for sorting.

comp

T
The comparison function used to determine the relative order of the elements.

SortIndices<T>(Span<int>, ReadOnlySpan<T>)

Sorts a span of indices by comparing a read-only span of values of type T, using a custom comparer.
public static void SortIndices<T>(this Span<int> indices, ReadOnlySpan<T> values) where T : unmanaged, IComparable<T>

Parameters

indices

Indices to sort. Indices must be unique, nonnegative, and strictly less than the length of values.

Values to use for sorting.