Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. autoptr.hxx
  6. Abstract:
  7. Auto pointer implmentation.
  8. Author:
  9. Steve Kiraly (SteveKi) 5/15/96
  10. Revision History:
  11. --*/
  12. #ifndef _AUTOPTR_HXX
  13. #define _AUTOPTR_HXX
  14. template<class T>
  15. class auto_ptr {
  16. public:
  17. // Constructor
  18. auto_ptr(
  19. T *p = 0
  20. );
  21. // Destructor
  22. ~auto_ptr(
  23. VOID
  24. );
  25. // Dereference
  26. T&
  27. operator*(
  28. VOID
  29. ) const;
  30. // Dereference
  31. T*
  32. operator->(
  33. VOID
  34. ) const;
  35. // Return value of current dumb pointer
  36. T*
  37. get(
  38. VOID
  39. ) const;
  40. // Relinquish ownership of current dumb pointer
  41. T*
  42. release(
  43. VOID
  44. );
  45. // Delete owned dumb pointer
  46. VOID
  47. reset(
  48. T *p
  49. );
  50. // Copying an auto pointer
  51. auto_ptr(
  52. const auto_ptr<T>& rhs
  53. );
  54. // Assign one auto pointer to another
  55. const auto_ptr<T>&
  56. operator=(
  57. const auto_ptr<T>& rhs
  58. );
  59. private:
  60. // Actual dumb pointer.
  61. T *pointee;
  62. };
  63. #if DBG
  64. #define _INLINE
  65. #else
  66. #define _INLINE inline
  67. #endif
  68. #include "autoptr.inl"
  69. #endif