System.Generics.Collections.TArray.Sort

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

class procedure Sort<T>(var Values: array of T); overload; static;
class procedure Sort<T>(var Values: array of T; const Comparer: IComparer<T>); overload; static;
class procedure Sort<T>(var Values: array of T;  const Comparer: IComparer<T>; Index, Count: Integer); overload; static;

C++

template<typename T> static void __fastcall Sort(T *Values, const int Values_High)/* overload */;
template<typename T> static void __fastcall Sort(T *Values, const int Values_High, const System::DelphiInterface<System::Generics::Defaults::IComparer__1<T> > Comparer)/* overload */;
template<typename T> static void __fastcall Sort(T *Values, const int Values_High, const System::DelphiInterface<System::Generics::Defaults::IComparer__1<T> > Comparer, int Index, int Count)/* overload */;

Properties

Type Visibility Source Unit Parent
procedure
function
public
System.Generics.Collections.pas
System.Generics.Collections.hpp
System.Generics.Collections TArray

Description

Sort generic array.

This method sorts the Values generic array, using an O(n log n) operation, where n is the number of elements in the array. The order of equal elements may not be preserved, since a QuickSort algorithm is used.

Note: If the Comparer parameter is provided, it is used to compare elements; otherwise the default comparator for the array elements is used.

See Also

Code Examples