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);
}
}