Hi,
I'm trying to extend TArray<T> generic with some functions and procedures, however, I can't get it to compile. Errors are in the code below. I'm not sure if it's possible what I want: to extend a generic with a generic type helper, or that I'm just messing it up. Pls give me some direction.
unit uArray;
{$mode delphi}{$H+}
{$ModeSwitch typehelpers}
interface
uses
SysUtils;
type
TArray<T> = array of T;
TArrayHelper<T> = type helper for TArray<T>
procedure InsertRange(const Index: Integer; Values: TArray<T>);
end;
implementation
{ TArrayHelper }
procedure TArrayHelper<T>.InsertRange(const Index: Integer; Values: TArray<T>);
begin
// insert the range
end;
end.
{
4 errors on line 15
Error: Syntax error "indentifier expected, but "<" found
Error: Type identifier expected
Error: Generics without specialization cannot be used as a type for a variable
[15,44] Error: expected ., but T found
}
Lazarus v 2.3.0 (date 2022-05-27); FPC v 3.3.1 (x86-64 Darwin Cocoa)