Replies: 2 comments 10 replies
-
I think this helper can be usefull (that's the reason why you have create it). or call it or call it |
Beta Was this translation helpful? Give feedback.
-
this would be beneficial ngl, but the naming can be like this:
Removing the present participle from the also.. one question, what is |
Beta Was this translation helpful? Give feedback.
-
I'm using a few helper classes at the moment in my own code, and I'm just wondering if there would be any benefit to adding them to the engine code.
Say you create an object of type
Node
to which you hold a local reference to it (withretain()
), and you no longer require it in the scene, you would need to call the following methods:Or, if you use
ax::RefPtr<Node>
, then it would be:Now, I've implemented
SelfRemovingNodePtr
, based onax::RefPtr
, but with a few additions. This would remove the node from the parent before releasing it, all within a single call:node = nullptr;
There is also another one named
SelfRemovingEventListenerPtr<T>
, where T is of typeEventListener
, which will remove the event listener from the event dispatcher before releasing it, also reducing the number of calls to one:eventListener = nullptr;
instead of
Would there be any benefit in adding these helper classes to the engine code? If yes, then the next question is, can someone think of better names for these classes (naming things is hard, and I hate naming things).
Beta Was this translation helpful? Give feedback.
All reactions