From 2525b15357b778cde2af9b418d3b97f8fcff0230 Mon Sep 17 00:00:00 2001 From: psychon Date: Thu, 20 Aug 2009 21:09:37 +0000 Subject: [PATCH] Remove unused class CNoCopy and CSafePtr They aren't used anywhere and IMHO they are pretty useless, too. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1607 726aef4b-f618-498e-8847-2d620e286838 --- Utils.h | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/Utils.h b/Utils.h index b7ff9d1b..e007cbb3 100644 --- a/Utils.h +++ b/Utils.h @@ -292,46 +292,6 @@ private: unsigned int m_uTTL; //!< Default time-to-live duration }; -/** - * @class CNoCopy - * @author prozac - * @brief This class is intended to be derived from to prevent copying of your derived class, the implementations of the copy constructor and equals operator were intentionally made private and omitted - */ -class CNoCopy { -protected: - CNoCopy() {} // Allow construction - ~CNoCopy() {} // and destruction of derived objects -private: - CNoCopy(const CNoCopy&); // Disallow copying - CNoCopy& operator =(const CNoCopy&); // and assignment -}; - -/** - * @class CSafePtr - * @author prozac - * @brief Safe deletion of a pointer. - * - * This class is intended to be created on the stack and hold a pointer which - * will be deleted upon destruction. It is useful for functions where you need - * an allocated pointer and have many return paths. It prevents copying to get - * around the exclusive ownership situation which makes std::auto_ptr - * invalidate the first pointer on copy. This is intended to be used in - * simplistic situations such as local variables. - */ -template -class CSafePtr : private CNoCopy { -public: - CSafePtr() { m_pType = new T; } - CSafePtr(T* p) { m_pType = p; } - virtual ~CSafePtr() { delete m_pType; } - - T& operator *() const { assert(m_pType); return *m_pType; } - T* operator ->() const { assert(m_pType); return m_pType; } -private: - operator T() const; - T* m_pType; -}; - /** * @class CSmartPtr * @author prozac