Single phase constructor is to push a pointer to the clean-up stack, and then complete its construction. It uses the macro CONSTRUCTORS_MAY_LEAVE that is necessary to ensure whether the cleanup is correctly handled in the event that a constructor may leave beneath a call to new(ELeave).
The following are the major characteristics of single phase constructor:
The following code snippet implies the usage of single phase constructor using CONSTRUCTORS_MAY_LEAVE macro.
class CManagedUserSinglePhase : public CBase { public: CONSTRUCTORS_MAY_LEAVE static CManagedUserSinglePhase* NewL(CTicker* aTicker) { return new(ELeave) CManagedUserSinglePhase(aTicker); } }
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.