Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

auto_ptr.h

Go to the documentation of this file.
00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT!         -*- c++ -*-
00002 
00003 #ifndef auto_ptr_h
00004 #define auto_ptr_h
00005 
00006 //
00007 // INTERFACE definition follows 
00008 //
00009 
00010 
00011 /*
00012  * Copyright (c) 1997
00013  * Silicon Graphics Computer Systems, Inc.
00014  *
00015  * Permission to use, copy, modify, distribute and sell this software
00016  * and its documentation for any purpose is hereby granted without fee,
00017  * provided that the above copyright notice appear in all copies and
00018  * that both that copyright notice and this permission notice appear
00019  * in supporting documentation.  Silicon Graphics makes no
00020  * representations about the suitability of this software for any
00021  * purpose.  It is provided "as is" without express or implied warranty.
00022  *
00023  */
00024 
00025 #ifndef __SGI_STL_MEMORY
00026 #define __SGI_STL_MEMORY
00027 
00028 // #include <stl_algobase.h>
00029 // #include <stl_alloc.h>
00030 // #include <stl_construct.h>
00031 // #include <stl_tempbuf.h>
00032 // #include <stl_uninitialized.h>
00033 // #include <stl_raw_storage_iter.h>
00034 
00035 #ifndef __STL_NOTHROW
00036 #define __STL_NOTHROW
00037 #endif
00038 
00039 //__STL_BEGIN_NAMESPACE
00040 
00041 template <class _Tp> class auto_ptr {
00042 private:
00043   _Tp* _M_ptr;
00044 
00045 public:
00046   typedef _Tp element_type;
00047   explicit auto_ptr(_Tp* __p = 0) __STL_NOTHROW : _M_ptr(__p) {}
00048   auto_ptr(auto_ptr& __a) __STL_NOTHROW : _M_ptr(__a.release()) {}
00049   template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) __STL_NOTHROW
00050     : _M_ptr(__a.release()) {}
00051   auto_ptr& operator=(auto_ptr& __a) __STL_NOTHROW {
00052     if (&__a != this) {
00053       delete _M_ptr;
00054       _M_ptr = __a.release();
00055     }
00056     return *this;
00057   }
00058   template <class _Tp1>
00059   auto_ptr& operator=(auto_ptr<_Tp1>& __a) __STL_NOTHROW {
00060     if (__a.get() != this->get()) {
00061       delete _M_ptr;
00062       _M_ptr = __a.release();
00063     }
00064     return *this;
00065   }
00066   ~auto_ptr() __STL_NOTHROW { delete _M_ptr; }
00067 
00068   _Tp& operator*() const __STL_NOTHROW {
00069     return *_M_ptr;
00070   }
00071   _Tp* operator->() const __STL_NOTHROW {
00072     return _M_ptr;
00073   }
00074   _Tp* get() const __STL_NOTHROW {
00075     return _M_ptr;
00076   }
00077   _Tp* release() __STL_NOTHROW {
00078     _Tp* __tmp = _M_ptr;
00079     _M_ptr = 0;
00080     return __tmp;
00081   }
00082   void reset(_Tp* __p = 0) __STL_NOTHROW {
00083     delete _M_ptr;
00084     _M_ptr = __p;
00085   }
00086 
00087   // According to the C++ standard, these conversions are required.  Most
00088   // present-day compilers, however, do not enforce that requirement---and, 
00089   // in fact, most present-day compilers do not support the language 
00090   // features that these conversions rely on.
00091 
00092 //#ifdef __SGI_STL_USE_AUTO_PTR_CONVERSIONS
00093 
00094 private:
00095   template<class _Tp1> struct auto_ptr_ref {
00096     _Tp1* _M_ptr;
00097     auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
00098   };
00099 
00100 public:
00101   auto_ptr(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW
00102     : _M_ptr(__ref._M_ptr) {}
00103   template <class _Tp1> operator auto_ptr_ref<_Tp1>() __STL_NOTHROW 
00104     { return auto_ptr_ref<_Tp>(this->release()); }
00105   template <class _Tp1> operator auto_ptr<_Tp1>() __STL_NOTHROW
00106     { return auto_ptr<_Tp1>(this->release()); }
00107 
00108 //#endif /* __SGI_STL_USE_AUTO_PTR_CONVERSIONS */
00109 };
00110 
00111 //__STL_END_NAMESPACE
00112 
00113 #endif /* __SGI_STL_MEMORY */
00114 
00115 #endif // auto_ptr_h

Generated on Mon Sep 26 14:20:10 2005 for Fiasco by  doxygen 1.4.2