Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Generic-swap/Free-Pascal/generic-swap.pas
Normal file
19
Task/Generic-swap/Free-Pascal/generic-swap.pas
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{$ifdef fpc}{$mode delphi}{$H+}{$endif}
|
||||
{ note this is compiled with delphi mode but will only compile in Free Pascal }
|
||||
{ Delphi doesn't support this syntax }
|
||||
procedure swap<T>(var left,right:T);
|
||||
var
|
||||
temp:T;
|
||||
begin
|
||||
temp:=left;
|
||||
left:=right;
|
||||
right:=temp;
|
||||
end;
|
||||
var
|
||||
a:string = 'Test';
|
||||
b:string = 'me';
|
||||
begin
|
||||
writeln(a:6,b:6);
|
||||
swap<string>(a,b);
|
||||
writeln(a:6,b:6);
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue