CleanupClosePushL()
The CleanupClosePushL()
templated function constructs
and pushes a TCleanupItem
onto the cleanup stack. When
CleanupStack::PopAndDestroy()
is called, the Close()
member function of the object encapsulated by the TCleanupItem
is
called.
...
RTestTwo two;
CleanupClosePushL(two);
...
CleanupStack::PopAndDestroy();
...
The TCleanupItem
object encapsulates a reference to the
RTestTwo
object; the cleanup operation is the static function
Close()
of the templated class CleanupClose<class
T>
. This is implemented by simply calling the Close()
member function of RTestTwo
. This means that RTestTwo
must define or inherit a member function Close()
which performs
whatever clean up is required.
In practice, this type of cleanup operation is commonly applied to handles which are constructed on the program stack.