]>
git.saurik.com Git - wxWidgets.git/blob - interface/ptr_shrd.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxSharedPtr<T> class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 A smart pointer with non-intrusive reference counting. It is modeled
14 after @b boost::shared_ptr and can be used with STL containers
15 and wxVector - unlike @b std::auto_ptr
22 wxScopedPtr, wxWeakRef, wxObjectDataPtr
31 wxSharedPtrT(T
* ptr
= @NULL
);
32 wxSharedPtrT(const wxSharedPtr
<T
>& tocopy
);
41 Returns pointer to its object or @NULL.
46 Conversion to a boolean expression (in a variant which is not
47 convertable to anything but a boolean expression). If this class
48 contains a valid pointer it will return @e @true, if it contains
49 a @NULL pointer it will return @e @false.
51 operator unspecified_bool_type();
54 Returns a reference to the object. If the internal pointer is @NULL this
55 method will cause an assert in debug mode.
60 Returns pointer to its object or @NULL.
65 Assignment operator. Releases any previously held pointer
66 and creates a reference to @e ptr.
68 wxSharedPtrT
& operator operator=(T
* ptr
);
71 Reset pointer to @e ptr. If the reference count of the
72 previously owned pointer was 1 it will be deleted.
74 void reset(T
* ptr
= @NULL
);
77 Returns @true if this is the only pointer pointing to its object.
82 Returns the number of pointers pointing to its object.