I’m resurrecting this blog one article at a time, so here’s another code drop!
What is CFQueueDestroyer?
Straight from the readme…
“CFQueueDestroyer is a simple class used to defer deletion of objects until a later date. Colloquially you can consider it be a “bucket” to discard no longer required objects into.
This could be worked into an object pooling or batch procedure invoker with relatively minimal work.”
In practice, I use this within a Cocos2D game I’m developing that harnesses the awesomeness of Box2D. When you’re mid physics tick you don’t want to be destroying Box2D bodies, so you defer the deletion of them until just after the tick. The role of the classes here is to act as a container for them with a singleton implemented around it too. Is niiice.
Also, before I get flamed, strictly speaking it’s not a queue. However, I am logically “queueing them up for deletion”.
Where can I get it?
You can find it on Github here