Update of /cvsroot/mahogany/M/include
In directory sc8-pr-cvs1:/tmp/cvs-serv14377/include

Modified Files:
        MObject.h 
Log Message:
added Swap() to autoptr class

Index: MObject.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MObject.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -b -u -2 -r1.28 -r1.29
--- MObject.h   8 Sep 2002 19:23:07 -0000       1.28
+++ MObject.h   27 Sep 2003 17:18:06 -0000      1.29
@@ -208,5 +208,5 @@
 
 // start auto ptr class declaration
-#define BEGIN_DECLARE_AUTOPTR_NO_BOOL_0(classname) \
+#define BEGIN_DECLARE_AUTOPTR_NO_BOOL(classname)                              \
    class classname##_obj \
    { \
@@ -232,24 +232,16 @@
       classname *operator->() const { return Get(); } \
  \
+      void Swap(classname##_obj& other)                                       \
+      {                                                                       \
+         classname *tmp = other.m_ptr;                                        \
+         other.m_ptr = m_ptr;                                                 \
+         m_ptr = tmp;                                                         \
+      }                                                                       \
+                                                                              \
    private: \
-      classname *m_ptr;
-
-// some compilers don't let us declare the copy ctor and assignment operator as
-// private (otherwise they refuse to compile things like "Foo_obj foo = pFoo"
-// with obscure error messages), but we do want to do it for other compilers
-// as copying smart pointers *is* illegal (whatever C++ standard says)
-#if defined(__GNUG__) || defined(__BORLANDC__)
-   #define NO_PRIVATE_COPY
-#endif
-
-#ifndef NO_PRIVATE_COPY
-    #define BEGIN_DECLARE_AUTOPTR_NO_BOOL(classname)   \
-            BEGIN_DECLARE_AUTOPTR_NO_BOOL_0(classname) \
+      classname *m_ptr;                                                       \
+                                                                              \
             classname##_obj(const classname##_obj &);  \
             classname##_obj& operator=(const classname##_obj &);
-#else // g++
-    #define BEGIN_DECLARE_AUTOPTR_NO_BOOL(classname) \
-            BEGIN_DECLARE_AUTOPTR_NO_BOOL_0(classname)
-#endif // !g++/g++
 
 // normally our autoptr class has an implicit conversion to bool for truth
@@ -267,5 +259,5 @@
 #define END_DECLARE_AUTOPTR() }
 
-// declare an class which is an auto ptr to the given MObjectRC-derived type
+// declare a class which is an auto ptr to the given MObjectRC-derived type
 #define DECLARE_AUTOPTR(classname)                    \
    BEGIN_DECLARE_AUTOPTR(classname)                   \



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to