> I remember something like this in RTTI though but can't find it in your
docs yet for generics.

{$mode objfpc}

uses
  typinfo;

generic procedure Add<T>;
begin
   if TypeInfo(T) = TypeInfo(Integer) then WriteLn('an integer');
   if TypeInfo(T) = TypeInfo(String) then WriteLn('a string');
end;

begin
  specialize Add<Integer>;
  specialize Add<String>;
end.



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to