mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 03:49:20 +02:00
* Add delphi-compatible TList constructor with array of values
This commit is contained in:
parent
70591f6449
commit
e958ad5126
@ -266,6 +266,7 @@ type
|
|||||||
constructor Create; overload;
|
constructor Create; overload;
|
||||||
constructor Create(const AComparer: IComparer<T>); overload;
|
constructor Create(const AComparer: IComparer<T>); overload;
|
||||||
constructor Create(ACollection: TEnumerable<T>); overload;
|
constructor Create(ACollection: TEnumerable<T>); overload;
|
||||||
|
constructor Create(aValues : Array of T); overload;
|
||||||
{$IFDEF ENABLE_METHODS_WITH_TEnumerableWithPointers}
|
{$IFDEF ENABLE_METHODS_WITH_TEnumerableWithPointers}
|
||||||
constructor Create(ACollection: TEnumerableWithPointers<T>); overload;
|
constructor Create(ACollection: TEnumerableWithPointers<T>); overload;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -1617,6 +1618,16 @@ begin
|
|||||||
Add(LItem);
|
Add(LItem);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
constructor TList<T>.Create(aValues : Array of T);
|
||||||
|
|
||||||
|
var
|
||||||
|
LItem: T;
|
||||||
|
begin
|
||||||
|
Create;
|
||||||
|
for LItem in aValues do
|
||||||
|
Add(LItem);
|
||||||
|
end;
|
||||||
|
|
||||||
{$IFDEF ENABLE_METHODS_WITH_TEnumerableWithPointers}
|
{$IFDEF ENABLE_METHODS_WITH_TEnumerableWithPointers}
|
||||||
constructor TList<T>.Create(ACollection: TEnumerableWithPointers<T>);
|
constructor TList<T>.Create(ACollection: TEnumerableWithPointers<T>);
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user