diff -r e8e3147d53eb -r b3431bff8c19 predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2Utils.h --- a/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2Utils.h Mon Mar 15 12:39:26 2010 +0200 +++ b/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2Utils.h Wed Mar 31 21:13:53 2010 +0300 @@ -64,4 +64,21 @@ static TBool IsGroupUri(TDesC& aURI); }; + +// CleanupStack helpers for item owning RPointerArrays +template +class CleanupResetAndDestroy + { +public: + inline static void PushL(T& aRef) + { CleanupStack::PushL(TCleanupItem(&ResetAndDestroy,&aRef)); } +private: + inline static void ResetAndDestroy(TAny *aPtr) + { static_cast(aPtr)->ResetAndDestroy(); } + }; + +template +inline void CleanupResetAndDestroyPushL(T& aRef) + { CleanupResetAndDestroy::PushL(aRef); } + #endif // C_PCS_ALGORITHM_2_UTILS