Inside a generic procedure (no objects used just a procedure) is there a way to check which type the code is being used for such as:

generic procedure Add<integer, string>();
begin
  if type = integer then...

  if type = string then...
  begin
    // specialized code for that type only
  end
end;

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

The current way might be to code up separate procedures for each type, but that's kind of defeating the purpose of generics since that would simply be an overloaded regular function.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to