Recent

Author Topic: For-in loop over constant array of strings - limited to length of first string?  (Read 5112 times)

ASerge

  • Hero Member
  • *****
  • Posts: 2337
I've used a generic wrapper function utilizing implicit function specializations that can then be used to access any enumerator.
The current version of FPC does not support {$modeswitch implicitfunctionspecialization}.

With code
Code: Pascal  [Select][+][-]
  1. for S in specialize WrapClass<TInverseStringsEnumerator>(SList.GetInverseEnumerator) do
  2.   Writeln(S);
there is a memory leak.

With
Code: Pascal  [Select][+][-]
  1. for S in specialize WrapRecord<TInverseStringsEnumerator>(SList.GetInverseEnumerator) do
  2.   Writeln(S);
not.

 

TinyPortal © 2005-2018