* Added generic IfThen, as proposed by Thaddy de Koning, bug id #34012

git-svn-id: trunk@39521 -
This commit is contained in:
michael 2018-07-29 09:35:54 +00:00
parent d5601e3631
commit 1e3f44965f
2 changed files with 13 additions and 0 deletions

View File

@ -266,6 +266,8 @@ type
procedure AddTerminateProc(TermProc: TTerminateProc);
function CallTerminateProcs: Boolean;
generic function IfThen<T>(val:boolean;const iftrue:T; const iffalse:T) :T; inline; overload;
Var
OnShowException : Procedure (Msg : ShortString);

View File

@ -801,3 +801,14 @@ begin
result:=ExecuteProcess(ToSingleByteFileSystemEncodedFileName(Path),ComLineA);
end;
{$endif}
// generic ifthen..
generic function IfThen<T>(val:boolean;const iftrue:T; const iffalse:T) :T; inline; overload;
begin
if val then
Result := ifTrue
else
Result:=ifFalse;
end;