summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcleeland <cleeland@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-08-25 21:02:31 +0000
committercleeland <cleeland@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-08-25 21:02:31 +0000
commit43f0d2332b4eb57cd7138d5ee3e8f5de75a70b08 (patch)
tree482e8c26f86974c7ae7340b08a41d59a099addeb
parentb8c8db2ebd9197186f976aa206be9a26f3dc3821 (diff)
downloadATCD-43f0d2332b4eb57cd7138d5ee3e8f5de75a70b08.tar.gz
Wed Aug 25 16:00:11 2004 Chris Cleeland <cleeland_c@ociweb.com>
Added new portable ACE_Auto_Ptr<>.
-rw-r--r--ChangeLog11
-rw-r--r--ace/Auto_Ptr.h30
-rw-r--r--ace/Auto_Ptr.inl7
3 files changed, 41 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index a194fb01ac6..dc6542a13f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Wed Aug 25 16:00:11 2004 Chris Cleeland <cleeland_c@ociweb.com>
+
+ * ace/Auto_Ptr.h:
+ * ace/Auto_Ptr.inl:
+
+ Added new ACE_Auto_Ptr which can be used more portably than
+ auto_ptr even with the ACE auto_ptr workarounds. Specifically, this
+ obviates the need for the ACE_AUTO_PTR_RESET macro, and will have
+ better performance than the pre-standard auto_ptr that comes with
+ VC6.
+
Wed Aug 25 14:58:51 2004 Rich Seibel <seibel_r@ociweb.com>
* include/makeincludes/platform_linux.GNU:
diff --git a/ace/Auto_Ptr.h b/ace/Auto_Ptr.h
index ab56839c2c3..4b3a4438791 100644
--- a/ace/Auto_Ptr.h
+++ b/ace/Auto_Ptr.h
@@ -92,6 +92,23 @@ public:
#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
+
+/**
+ * @brief Implements the draft C++ standard auto_ptr abstraction.
+ * This version can be used instead of auto_ptr<T>, and obviates
+ * the need for the ACE_AUTO_PTR_RESET macro on platforms like
+ * VC6 where the auto_ptr<T> is broken.
+ */
+template <class X>
+class ACE_Auto_Ptr : public ACE_Auto_Basic_Ptr <X>
+{
+public:
+ // = Initialization and termination methods
+ explicit ACE_Auto_Ptr (X *p = 0) : ACE_Auto_Basic_Ptr<X> (p) {}
+
+ X *operator-> () const;
+};
+
/**
* @class ACE_Auto_Basic_Array_Ptr
*
@@ -150,18 +167,18 @@ public:
// easily. Portability to these platforms requires
// use of the following ACE_AUTO_PTR_RESET macro.
# if defined (ACE_AUTO_PTR_LACKS_RESET)
-# define ACE_AUTO_PTR_RESET(X,Y,Z) \
+# define ACE_AUTO_PTR_RESET(AUTOPTR,NEWPTR,TYPE) \
do { \
- if (Y != X.get ()) \
+ if (NEWPTR != AUTOPTR.get ()) \
{ \
- X.release (); \
- X = auto_ptr<Z> (Y); \
+ AUTOPTR.release (); \
+ AUTOPTR = auto_ptr<TYPE> (NEWPTR); \
} \
} while (0)
# else /* ! ACE_AUTO_PTR_LACKS_RESET */
-# define ACE_AUTO_PTR_RESET(X,Y,Z) \
+# define ACE_AUTO_PTR_RESET(AUTOPTR,NEWPTR,TYPE) \
do { \
- X.reset (Y); \
+ AUTOPTR.reset (NEWPTR); \
} while (0)
# endif /* ACE_AUTO_PTR_LACKS_RESET */
@@ -182,5 +199,4 @@ public:
# pragma warning(pop)
#endif /* _MSC_VER */
-#include /**/ "ace/post.h"
#endif /* ACE_AUTO_PTR_H */
diff --git a/ace/Auto_Ptr.inl b/ace/Auto_Ptr.inl
index d891930000e..ce4d53a490c 100644
--- a/ace/Auto_Ptr.inl
+++ b/ace/Auto_Ptr.inl
@@ -92,6 +92,13 @@ auto_ptr<X>::operator-> () const
#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
template<class X> ACE_INLINE X *
+ACE_Auto_Ptr<X>::operator-> () const
+{
+ ACE_TRACE ("ACE_Auto_Ptr<X>::operator->");
+ return this->get ();
+}
+
+template<class X> ACE_INLINE X *
ACE_Auto_Basic_Array_Ptr<X>::get (void) const
{
ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::get");