unit Generics.Utils;
interface
uses
System.SysUtils;
type
TWrapper =
class
class function Proc<T>( AProc: TProc<T>; Arg: T ): TProc;
overload;
class function Proc<T1, T2>( AProc: TProc<T1, T2>; Arg1: T1; Arg2: T2 ): TProc;
overload;
class function Proc<T1, T2, T3>( AProc: TProc<T1, T2, T3>; Arg1: T1; Arg2: T2; Arg3: T3 ): TProc;
overload;
class function Proc<T1, T2, T3, T4>( AProc: TProc<T1, T2, T3, T4>; Arg1: T1; Arg2: T2; Arg3: T3; Arg4: T4 ): TProc;
overload;
end;
implementation
{TWrapper}
class function TWrapper.Proc<T1, T2, T3, T4>( AProc: TProc<T1, T2, T3, T4>; Arg1: T1; Arg2: T2; Arg3: T3; Arg4: T4 ): TProc;
begin
Result :=
procedure
begin
AProc( Arg1, Arg2, Arg3, Arg4 );
end;
end;
class function TWrapper.Proc<T1, T2, T3>( AProc: TProc<T1, T2, T3>; Arg1: T1; Arg2: T2; Arg3: T3 ): TProc;
begin
Result :=
procedure
begin
AProc( Arg1, Arg2, Arg3 );
end;
end;
class function TWrapper.Proc<T1, T2>( AProc: TProc<T1, T2>; Arg1: T1; Arg2: T2 ): TProc;
begin
Result :=
procedure
begin
AProc( Arg1, Arg2 );
end;
end;
class function TWrapper.Proc<T>( AProc: TProc<T>; Arg: T ): TProc;
begin
Result :=
procedure
begin
AProc( Arg );
end;
end;
end.