home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2002 April / Game.EXE_04_2002.iso / Alawar / AutoPtr.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-02  |  570 b   |  35 lines

  1. #ifndef AUTOPTR_H
  2. #define AUTOPTR_H
  3.  
  4. template<class T>
  5. class AutoPtr
  6. {
  7.     const AutoPtr & operator=(const AutoPtr & );
  8. public:
  9.     AutoPtr( T * ptr = 0)
  10.         :    ptr( ptr )
  11.     {}
  12.     // ▌≥ε≥ Ωεφ±≥≡≤Ω≥ε≡ ΓΩδ■≈σφ ≥εδⁿΩε Σδ  BCC5.5, Ωε≥ε≡√Θ φσ∩≡αΓΦδⁿφε
  13.     // εß≡αßα≥√Γασ≥ ∩≡αΓΦδε, ≈≥ε ∩σ≡Γεσ ∩≡Φ±ΓεσφΦσ σ±≥ⁿ ΦφΦ÷ΦαδΦτα÷Φ 
  14.     AutoPtr(const AutoPtr & au)
  15.         :    ptr( au.ptr )
  16.     {
  17.         au.ptr = 0;
  18.     }
  19.     ~AutoPtr()
  20.     {
  21.         delete ptr; ptr = 0;
  22.     }
  23.     T * operator->()
  24.     {
  25.         return ptr;
  26.     }
  27.     operator bool()const
  28.     {
  29.         return ptr != 0;
  30.     }
  31. private:
  32.     T * ptr;
  33. };
  34.  
  35. #endif //AUTOPTR_H