source: Generics/NativeGenerics/Generic/GenericSet.pas

Last change on this file was 496, checked in by chronos, 7 years ago
  • Modified: New native generics classes working under FPC 3.0 transformed from TemplateGenerics package.
File size: 587 bytes
Line 
1unit GenericSet;
2
3{$mode delphi}
4
5interface
6
7uses
8 GenericList;
9
10type
11 TGSet<T> = class
12 private
13 FList: TGList<T>;
14 public
15 function IsIn(Item: T): Boolean;
16 constructor Create;
17 destructor Destroy; override;
18 property List: TGList<T> read FList;
19 end;
20
21implementation
22
23{ TGSet }
24
25function TGSet<T>.IsIn(Item: T): Boolean;
26begin
27 Result := FList.IndexOf(Item) <> -1;
28end;
29
30constructor TGSet<T>.Create;
31begin
32 FList := TGList<T>.Create;
33end;
34
35destructor TGSet<T>.Destroy;
36begin
37 FList.Free;
38 inherited Destroy;
39end;
40
41end.
Note: See TracBrowser for help on using the repository browser.