mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 10:20:21 +02:00
Mantis #22540 was fixed by partial specializations addition in revision 27861
+ added test git-svn-id: trunk@27893 -
This commit is contained in:
parent
ae627a4ba8
commit
c1fdce5166
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13773,6 +13773,7 @@ tests/webtbs/tw22433.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw22490.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2250.pp svneol=native#text/plain
|
||||
tests/webtbs/tw22502.pp svneol=native#text/plain
|
||||
tests/webtbs/tw22540.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw22561.pp svneol=native#text/plain
|
||||
tests/webtbs/tw22570.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2259.pp svneol=native#text/plain
|
||||
|
58
tests/webtbs/tw22540.pp
Normal file
58
tests/webtbs/tw22540.pp
Normal file
@ -0,0 +1,58 @@
|
||||
unit tw22540;
|
||||
|
||||
interface
|
||||
|
||||
{$ifdef FPC}
|
||||
{$Mode Delphi}
|
||||
{$endif}
|
||||
{$pointermath on} // Be more objfpc like in overindexing and removing of ^.
|
||||
{$inline on}
|
||||
|
||||
type
|
||||
{$ifndef FPC} Ptrint=integer; {$endif}
|
||||
TLightMap<tkey,tvalue> = class
|
||||
Type
|
||||
PKey = ^TKey;
|
||||
PValue= ^TValue;
|
||||
TKeyCompareFunc = function(const Key1, Key2: TKey): PtrInt; // returns ptrint in FPC, don't know about XE2
|
||||
TFinalizeKeyFunc = Procedure(var Key1:TKey) of object;
|
||||
private
|
||||
keycomparefunc:TKeyCompareFunc;
|
||||
finalizekeyfunc:TFinalizeKeyFunc; // finalize keys. NIL if unused.
|
||||
public
|
||||
constructor Create; virtual;
|
||||
end;
|
||||
|
||||
TLightStringMap<tvalue> = class(TLightMap<string,tvalue>)
|
||||
constructor create; override;
|
||||
procedure finalizestring(var s:string);
|
||||
end;
|
||||
|
||||
TLightStringMapInteger = class(TLightStringMap<Integer>);
|
||||
|
||||
implementation
|
||||
|
||||
Uses Sysutils;
|
||||
|
||||
{ TLightMap<tkey, tvalue> }
|
||||
|
||||
constructor TLightMap<tkey, tvalue>.Create;
|
||||
begin
|
||||
end;
|
||||
|
||||
{ TLightStringMap<tvalue> }
|
||||
|
||||
constructor TLightStringMap<tvalue>.create;
|
||||
begin
|
||||
inherited;
|
||||
keycomparefunc:=comparestr;
|
||||
finalizekeyfunc:=finalizestring;
|
||||
end;
|
||||
|
||||
procedure TLightStringMap<tvalue>.finalizestring(var s: string);
|
||||
begin
|
||||
finalize (s);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
Loading…
Reference in New Issue
Block a user