[Gambas-user] Class array iterations

BB adamnt42 at gmail.com
Wed Jan 25 07:18:11 CET 2023


Class arrays, (in fact any array,) could do with a property to return 
the index of the current item being pointed at. This would aid in the 
following case where there are two "parallel" arrays.

Dim SomeSet as new SomeClass[]
Dim AnotherSet as new AnotherClass[]

Dim SomeItem as SomeClass
Dim AnotherItem as AnotherClass

'  fill the arrays however, then

For Each SomeItem in SomeClass[]
     AnotherItem=AnotherSet[SomeItem.Index]

' Then I can process the equivalent items in both arrays
...

Any chance Benoit? I have had a look at gb_array.h and there seems to be 
a _pos integer used commonly but that code is way above my pay grade.

I know I could do it using an indexer to perform the iteration but I 
have "lots" of places where I have used For Each

bruce

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230125/c1f1cc20/attachment.htm>


More information about the User mailing list