PageRenderTime 24ms CodeModel.GetById 15ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/packages/fcl-stl/doc/setexample.pp

https://github.com/slibre/freepascal
Puppet | 27 lines | 22 code | 5 blank | 0 comment | 1 complexity | 76b204615e763a3b7d9107b88352bb40 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
 1uses gset, gutil;
 2
 3type lesslli=specialize TLess<longint>;
 4     setlli=specialize TSet<longint, lesslli>;
 5
 6var data:setlli; i:longint; iterator:setlli.TIterator;
 7
 8begin
 9  data:=setlli.Create;
10
11  for i:=0 to 10 do
12    data.insert(i);
13
14  {Iteration through elements}
15  iterator:=data.Min;
16  repeat
17    writeln(iterator.Data);
18  until not iterator.next;
19  {Don't forget to destroy iterator}
20  iterator.Destroy;
21
22  iterator := data.FindLess(7);
23  writeln(iterator.Data);
24  iterator.Destroy;
25
26  data.Destroy;
27end.