Page 1 of 1

List of typed pointers

Posted: Sun Jun 14, 2020 10:31 am
by Rinzwind
I didn't know this feature... but experimenting shows it's working.
Normally a list handles its structures itself. An assignment makes a copy of the structure. Here we just pass pointers directly, saving memory etc.

Code: Select all

EnableExplicit

Structure Test
  Name.s
EndStructure

Define a.Test
a\Name = "Test"

NewList *l.Test()

AddElement(*l())
*l() = a ; assign a memory reference

Debug @a\Name
Debug @*l()\Name ;same address

Debug *l()\Name
So basically a typed pointer list. Better than using a generic .i list.

Re: List of typed pointers

Posted: Sun Jun 14, 2020 11:05 am
by Josh
I use this a lot. Especially useful are PointerMaps, where several lists can easily be linked to one search index.