View Issue Details

IDProjectCategoryView StatusLast Update
0035940FPCFCLpublic2019-08-09 14:22
ReporterheXAssigned To 
Status newResolutionopen 
Product Version3.3.1Product Build 
Target VersionFixed in Version 
Summary0035940: fcl-stl - support for the standard enumerator class (for in / foreach)

in this thread, a person wrote that he made such an implementation, but I don’t know how to contact him.
TagsNo tags attached.
Fixed in Revision
Attached Files



2019-08-08 12:35

reporter   ~0117590

Last edited: 2019-08-08 12:35

View 2 revisions

Current enumeration code:

var i: TMapFolderInfo.TIterator;
  i := MapFolderInfo.Iterator();
  if i <> nil then
      until not i.Next;

Expected code:

  for i in MapFolderInfo do

Thaddy de Koning

2019-08-09 09:48

reporter   ~0117600

Last edited: 2019-08-09 10:02

View 2 revisions

Your code is wrong:
Use a while loop, not a repeat loop.
The repeat doesn't take into account the event that there is no i.Next or something to free to start with.
A while loop would break immediately.

After that there is no problem with the code.

Thaddy de Koning

2019-08-09 09:51

reporter   ~0117601

Btw: Michael will read this.

Marco van de Voort

2019-08-09 14:22

manager   ~0117613

For such scheme to work, the iterator must be stack based (a record, like in my lightcontainers) or an interface.

ghashmap's iterators are classes however , so they must be manually freed.

Issue History

Date Modified Username Field Change
2019-08-08 12:25 heX New Issue
2019-08-08 12:35 heX Note Added: 0117590
2019-08-08 12:35 heX Note Edited: 0117590 View Revisions
2019-08-09 09:48 Thaddy de Koning Note Added: 0117600
2019-08-09 09:51 Thaddy de Koning Note Added: 0117601
2019-08-09 10:02 Thaddy de Koning Note Edited: 0117600 View Revisions
2019-08-09 14:22 Marco van de Voort Note Added: 0117613