From: Christian P. <cp...@us...> - 2005-04-25 11:03:47
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20587/include/pclasses Modified Files: IntrusivePtr.h ScopedPtr.h SharedPtr.h Log Message: - Removed #ifdef PCLASSES_WITH_STL, the stl is required Index: IntrusivePtr.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/IntrusivePtr.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- IntrusivePtr.h 22 Dec 2004 17:54:38 -0000 1.1.1.1 +++ IntrusivePtr.h 25 Apr 2005 11:03:19 -0000 1.2 @@ -18,14 +18,11 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _P_IntrusivePtr_h_ -#define _P_IntrusivePtr_h_ +#ifndef P_IntrusivePtr_h +#define P_IntrusivePtr_h #include <pclasses/Alloc.h> - -#ifdef PCLASSES_WITH_STL #include <memory> -#endif namespace P { @@ -43,11 +40,9 @@ : _ptr(ptr.release()) { } -#ifdef PCLASSES_WITH_STL explicit IntrusivePtr(std::auto_ptr<Type>& ptr) throw() : _ptr(ptr.release()) { } -#endif ~IntrusivePtr() throw() { checked_delete(_ptr); } @@ -93,18 +88,20 @@ return *this; } -#ifdef PCLASSES_WITH_STL IntrusivePtr& operator=(std::auto_ptr<Type>& ptr) throw() { IntrusivePtr(ptr).swap(*this); return *this; } -#endif - + private: Type* _ptr; }; +template <class Type> +inline void swap(IntrusivePtr<Type>& a, IntrusivePtr<Type>& b) throw() +{ a.swap(b); } + } // !namespace P #endif Index: SharedPtr.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/SharedPtr.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- SharedPtr.h 22 Dec 2004 17:54:39 -0000 1.1.1.1 +++ SharedPtr.h 25 Apr 2005 11:03:19 -0000 1.2 @@ -18,15 +18,12 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _P_Core_SharedPtr_h_ -#define _P_Core_SharedPtr_h_ +#ifndef P_SharedPtr_h +#define P_SharedPtr_h #include <pclasses/Exception.h> #include <pclasses/Atomic.h> - -#ifdef PCLASSES_WITH_STL - #include <memory> -#endif +#include <memory> namespace P { @@ -43,11 +40,9 @@ : _ptr(ptr._ptr) { _ptr->getRef(); } -#ifdef PCLASSES_WITH_STL explicit SharedPtr(std::auto_ptr<Type> ptr) throw(OutOfMemory) : _ptr(alloc(ptr.release())) { } -#endif ~SharedPtr() throw() { _ptr->putRef(); } @@ -83,13 +78,11 @@ return *this; } -#ifdef PCLASSES_WITH_STL SharedPtr& operator=(std::auto_ptr<Type>& ptr) throw(OutOfMemory) { SharedPtr(ptr).swap(*this); return *this; } -#endif SharedPtr& operator=(const SharedPtr& ptr) throw() { Index: ScopedPtr.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/ScopedPtr.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- ScopedPtr.h 22 Dec 2004 17:54:40 -0000 1.1.1.1 +++ ScopedPtr.h 25 Apr 2005 11:03:19 -0000 1.2 @@ -18,14 +18,11 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _P_ScopedPtr_h_ -#define _P_ScopedPtr_h_ +#ifndef P_ScopedPtr_h +#define P_ScopedPtr_h #include <pclasses/Alloc.h> - -#ifdef PCLASSES_WITH_STL #include <memory> -#endif namespace P { @@ -39,11 +36,9 @@ : _ptr(ptr) { } -#ifdef PCLASSES_WITH_STL explicit ScopedPtr(std::auto_ptr<Type> ptr) throw() : _ptr(ptr.release()) { } -#endif ~ScopedPtr() throw() { checked_delete(_ptr); } @@ -83,14 +78,12 @@ return *this; } -#ifdef PCLASSES_WITH_STL ScopedPtr& operator=(std::auto_ptr<Type>& ptr) throw() { ScopedPtr(ptr).swap(*this); return *this; } -#endif - + private: ScopedPtr(const ScopedPtr&); ScopedPtr& operator=(const ScopedPtr&); |