Adding objects | |
| Add the given object reference to the topmost autorelease pool. | |
| void | AddObject (const CP_M_RefCounted *inObj) |
| Add the given object reference to the this autorelease pool. | |
| static void | AddObjectToTopMostPool (const CP_M_RefCounted *inObj) |
Public Member Functions | |
| void | ReleaseAll () |
| Release all references inside this pool. | |
Constructor / Destructor | |
| CP_AutoReleasePool () | |
| Constructor. | |
| ~CP_AutoReleasePool () | |
| Destructor. | |
Protected Attributes | |
| std::vector< const CP_M_RefCounted * > | fObjects |
| Object references managed by this pool. | |
A* getAnA()
{
A* a = new A;
a->AutoRelease();
return a;
}
void foo()
{
A* a = getAnA(); // no idea whether foo creates A, but it doesn't matter, since autorelease pool takes care.
// ... do something with a
// no need to release a here.
}
|
|
Create a new autorelease pool and push it onto the stack of available pools. Any subsequent call to AddObjectToTopMostPool will result in the object to be added to the new autorelease pool. |
|
|
|
|
|
|
|
|
|
|
|
Releases all registered object references in reverse order of addition. |
|
|
|
1.4.0