dbertoni 00/06/27 09:28:12
Modified: c/src/PlatformSupport STLHelper.hpp
Log:
Added assignment operator and copy constructor to array_auto_ptr.
Revision Changes Path
1.8 +20 -1 xml-xalan/c/src/PlatformSupport/STLHelper.hpp
Index: STLHelper.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/STLHelper.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- STLHelper.hpp 2000/06/01 15:23:20 1.7
+++ STLHelper.hpp 2000/06/27 16:28:12 1.8
@@ -91,14 +91,33 @@
+// A class similar to auto_ptr, but for arrays.
template<class T>
class array_auto_ptr
{
public:
- array_auto_ptr(T* thePointer) :
+ array_auto_ptr(T* thePointer = 0) :
m_pointer(thePointer)
{
+ }
+
+ array_auto_ptr(array_auto_ptr& theSource) :
+ m_pointer(theSource.release())
+ {
+ }
+
+ array_auto_ptr&
+ operator=(array_auto_ptr& theRHS)
+ {
+ if (this != &theRHS)
+ {
+ delete m_pointer;
+
+ m_pointer = theRHS.release();
+ }
+
+ return *this;
}
~array_auto_ptr()