Does a debugger understands that?<span></span><br><br>On Friday, August 2, 2013, Sven Barth wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello together!<br>
<br>
Just a little feature teaser what I'm currently working on when I find the time. :)<br>
<br>
=== source begin ===<br>
<br>
program tgenfuncs;<br>
<br>
{$modeswitch result}<br>
<br>
generic function IsIn<T>(aElement: T; const aArray: array of T): Boolean;<br>
var<br>
elem: T;<br>
begin<br>
for elem in aArray do<br>
if elem = aElement then<br>
Exit(True);<br>
Result := False;<br>
end;<br>
<br>
begin<br>
Writeln(specialize IsIn<LongInt>(42, [21, 42, 84]));<br>
Writeln(specialize IsIn<LongInt>(5, [21, 42, 84]));<br>
Writeln(specialize IsIn<String>('Foobar', ['Foo', 'Bar', 'Blubber']));<br>
end.<br>
<br>
=== source end ===<br>
<br>
=== console begin ===<br>
<br>
PS D:\svn\fpc> .\compiler\i386\pp.exe -n -Furtl\units\i386-win32 -FEtestoutput -viwn .\fpctests\tgenfuncs.pas<br>
Target OS: Win32 for i386<br>
Compiling .\fpctests\tgenfuncs.pas<br>
Linking testoutput\tgenfuncs.exe<br>
19 lines compiled, 0.3 sec, 32224 bytes code, 1204 bytes data<br>
PS D:\svn\fpc> .\testoutput\tgenfuncs.exe<br>
TRUE<br>
FALSE<br>
FALSE<br>
<br>
=== console end ===<br>
<br>
Regards,<br>
Sven<br>
______________________________<u></u>_________________<br>
fpc-devel maillist - <a>fpc-devel@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-devel" target="_blank">http://lists.freepascal.org/<u></u>mailman/listinfo/fpc-devel</a><br>
</blockquote>