• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[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