Before beginning you must know the following:
An LCleanedupX object is declared using one of the class template constructors. The type to be managed is declared as the first template parameter. An optional second template parameter can be declared to implement a non-default cleanup strategy.
An example code snippet for declaring LCleanedupX class is shown below:
An object that is being managed by an LCleanedupX class can be unmanaged by calling the Unmanage() method of the LCleanedupX class.
The managing object can be accessed using the . operator as in the call to Unmanage() . The Unmanage() disables cleanup and yields the previously managed pointer so that it can be safely returned.
An example code snippet is given below:
The managed object can be accessed using the -> operator as in the call to ConstructL()
The managed object can be passed to a function by dereferencing the managing object. An example code snippet is given below:
The RegisterTicker function defined above takes a CTicker& argument. If we have a LCleanedupPtr<CTicker> as defined below, we can pass the CTicker object to the function by dereferencing as shown below in the code snippet:
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License v1.0.