[vJASS] Loop through all instances of a struct

Status
Not open for further replies.
Level 18
Joined
Mar 21, 2011
Messages
1,622
Hey guys,

is there a built in way to loop through all instances of a struct?
I usually write my own allocate/deallocate with a double linked list, so i can just go through the instances.
But in certain cases, i want pre-build structs (non array), so i wonder if there is a default way to do so?

thanks!
 
No. In many cases all 'currently in use' instances are sequential but that isn't guaranteed. Best you could do would be to implement a boolean member that gets set = true/false on allocate/deallocate, then loop over them all manually from 0 to 32767 while checking that member. Stop the loop early if (for example) you find N or more inactive instances sequentially.
 
Last edited:
Status
Not open for further replies.
Back
Top