Drain query #97
Labels
A - Querying
Area: Querying components of entities.
C - Enhancement
Category: New feature or request.
P - Low
Priority: Not particularly urgent.
S - Needs Investigation
Status: Further investigation is needed.
Related to #59 in that it's another collection method.
The idea is to add a method named
drain
that returns an iterator over the queried entities, removing them from theWorld
at the same time. The signature of the method would be the same as that ofquery
, with views and a filter.Care would need to be taken to remove the entities from the entity allocator as well. The drain can also return entity identifiers, but they will not be valid anymore, which will be indicated by their generations. The documentation should note this.
The returned iterator could have a reference to the actual archetypes in-memory to facilitate the iteration, similar to how, say,
HashSet
'sdrain
method works.Note that the returned entities shouldn't be references, but could instead be the values directly moved, since they will no longer exists in their archetypes after iteration.
The text was updated successfully, but these errors were encountered: