unit uw40844b; {$ifdef FPC}{$mode DELPHI}{$endif} interface type IComparer = interface function Compare(const Left, Right: T): Integer; overload; end; IEnumerable = interface function GetEnumerator: IEnumerable; end; type Enumerable = record public class function Create(const AItems: TArray): Enumerable; overload; static; class operator Implicit(const AItems: IEnumerable): Enumerable; class function Empty: Enumerable; static; function OrderBy(const AComparer: IComparer): Enumerable; overload; end; TFastListRec = record public procedure Sort; overload; inline; procedure Sort(const AComparer: IComparer); overload; inline; end; { TFastList } TFastList = class(TObject) strict private FList: TFastListRec; public function AsEnumerable: Enumerable; end; TFastArray = record strict private class procedure SortImpl(L, R: Pointer; const AComparer: IComparer); overload; static; class procedure SortImpl(L, R: Pointer); overload; static; public class procedure Sort(AValues: Pointer; ACount: Integer); overload; static; inline; class procedure Sort(AValues: Pointer; ACount: Integer; const AComparer: IComparer); overload; static; inline; end; implementation uses uw40844c; { TFastArray } class procedure TFastArray.SortImpl(L, R: Pointer); begin end; class procedure TFastArray.Sort(AValues: Pointer; ACount: Integer); begin SortImpl(AValues, nil); end; class procedure TFastArray.Sort(AValues: Pointer; ACount: Integer; const AComparer: IComparer); begin SortImpl (AValues, nil, nil); SortImpl(AValues, nil, nil); end; class procedure TFastArray.SortImpl(L, R: Pointer; const AComparer: IComparer); begin end; { Enumerable } class function Enumerable.Create(const AItems: TArray): Enumerable; begin TArrayEnumerable.Create(AItems); end; class operator Enumerable.Implicit(const AItems: IEnumerable): Enumerable; begin end; function Enumerable.OrderBy(const AComparer: IComparer): Enumerable; begin Result := TStableOrderByEnumerable.Create(nil, AComparer); end; class function Enumerable.Empty: Enumerable; begin Result := TEmptyEnumerable.Create; end; { TFastListRec } procedure TFastListRec.Sort(const AComparer: IComparer); begin TFastArray.Sort(nil, 0, AComparer); end; procedure TFastListRec.Sort; begin TFastArray.Sort(nil, 0); end; { TFastList } function TFastList.AsEnumerable: Enumerable; begin end; end.