]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/ptr_shrd.h
   1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     interface of wxSharedPtr<T> 
   4 // Author:      wxWidgets team 
   6 // Licence:     wxWindows license 
   7 ///////////////////////////////////////////////////////////////////////////// 
  11     A smart pointer with non-intrusive reference counting. It is modeled after 
  12     @c boost::shared_ptr<> and can be used with STL containers and wxVector<T> - 
  13     unlike @c std::auto_ptr<> and wxScopedPtr<T>. 
  16     @category{smartpointers} 
  18     @see wxScopedPtr<T>, wxWeakRef<T>, wxObjectDataPtr<T> 
  28         Creates shared pointer from the raw pointer @a ptr and takes ownership 
  31     wxEXPLICIT 
wxSharedPtr(T
* ptr 
= NULL
); 
  36     wxSharedPtr(const wxSharedPtr
<T
>& tocopy
); 
  44         Returns pointer to its object or @NULL. 
  49         Conversion to a boolean expression (in a variant which is not 
  50         convertable to anything but a boolean expression). 
  52         If this class contains a valid pointer it will return @true, if it contains 
  53         a @NULL pointer it will return @false. 
  55     operator unspecified_bool_type() const; 
  58         Returns a reference to the object. 
  60         If the internal pointer is @NULL this method will cause an assert in debug mode. 
  65         Returns pointer to its object or @NULL. 
  67     T
* operator->() const; 
  72         Releases any previously held pointer and creates a reference to @a ptr. 
  74     wxSharedPtr
<T
>& operator=(T
* ptr
); 
  79         Releases any previously held pointer and creates a reference to the 
  80         same object as @a topcopy. 
  82     wxSharedPtr
<T
>& operator=(const wxSharedPtr
<T
>& tocopy
); 
  85         Reset pointer to @a ptr. 
  87         If the reference count of the previously owned pointer was 1 it will be deleted. 
  89     void reset(T
* ptr 
= NULL
); 
  92         Returns @true if this is the only pointer pointing to its object. 
  97         Returns the number of pointers pointing to its object. 
  99     long use_count() const;