Here is a patch which will fix the missing "reset" method in the
standard C++ auto_ptr class template. To apply the patch, feed this
e-mail to the patch program after you cd to $ROOTSYS/cint. For example:
$ cd $ROOTSYS/cint
$ patch -p1 -b < ../memory_auto_ptr.patch
Regards, Matt
Sean> I noticed that there was no way to reset an auto_ptr which is
Sean> required in the C++ standard. Would it be possible to add this
Sean> essential method in the next release of Root? That would be very
Sean> nice. Thanks -- Sean
Masa> I try to implement it in next release cint5.14.40.
Masa>
Masa> Meanwhile, you can modify cint/stl/_memory and
Masa> cint/lib/prec_stl/memory by yourself.
--
Matthew D. Langston
SLD, Stanford Linear Accelerator Center
langston@SLAC.Stanford.EDU
diff -uNr cint.orig/lib/prec_stl/memory cint/lib/prec_stl/memory
--- cint.orig/lib/prec_stl/memory Fri May 5 04:07:41 2000
+++ cint/lib/prec_stl/memory Tue May 23 12:20:02 2000
@@ -165,6 +165,12 @@
X* get() const { return ptr; }
X* release() const { owns = false; return ptr; }
+ void reset( X* __p = 0 )
+ {
+ delete ptr;
+ ptr = __p;
+ }
+
// auto_ptr conversions
//auto_ptr(auto_ptr_ref<X>& x) { }
//template<class Y> operator auto_ptr_ref<Y>() { return auto_ptr_ref<Y>(); }
diff -uNr cint.orig/stl/_memory cint/stl/_memory
--- cint.orig/stl/_memory Fri May 5 04:07:41 2000
+++ cint/stl/_memory Tue May 23 12:20:17 2000
@@ -64,6 +64,12 @@
X* get() const { return ptr; }
X* release() const { owns = false; return ptr; }
+ void reset( X* __p = 0 )
+ {
+ delete ptr;
+ ptr = __p;
+ }
+
// auto_ptr conversions
//auto_ptr(auto_ptr_ref<X>& x) { }
//template<class Y> operator auto_ptr_ref<Y>() { return auto_ptr_ref<Y>(); }
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:25 MET