Tuples
This commit is contained in:
@@ -12,6 +12,34 @@ type
|
||||
property Count: Integer read GetCount;
|
||||
end;
|
||||
|
||||
// Concrete generic implementation
|
||||
TTupleImpl<T> = class(TInterfacedObject, ITuple<T>)
|
||||
private
|
||||
FItems: TArray<T>;
|
||||
function GetItems(Idx: Integer): T;
|
||||
function GetCount: Integer;
|
||||
public
|
||||
constructor Create(const AItems: TArray<T>);
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TTupleImpl<T> }
|
||||
|
||||
constructor TTupleImpl<T>.Create(const AItems: TArray<T>);
|
||||
begin
|
||||
inherited Create;
|
||||
FItems := AItems;
|
||||
end;
|
||||
|
||||
function TTupleImpl<T>.GetCount: Integer;
|
||||
begin
|
||||
Result := Length(FItems);
|
||||
end;
|
||||
|
||||
function TTupleImpl<T>.GetItems(Idx: Integer): T;
|
||||
begin
|
||||
Result := FItems[Idx];
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user