]>
git.saurik.com Git - wxWidgets.git/blob - interface/ptr_shrd.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxSharedPtr<T>
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
21 @see wxScopedPtr, wxWeakRef, wxObjectDataPtr
30 wxSharedPtrT(T
* ptr
= NULL
);
31 wxSharedPtrT(const wxSharedPtr
<T
>& tocopy
);
40 Returns pointer to its object or @NULL.
45 Conversion to a boolean expression (in a variant which is not
46 convertable to anything but a boolean expression). If this class
47 contains a valid pointer it will return @e @true, if it contains
48 a @NULL pointer it will return @e @false.
50 operator unspecified_bool_type() const;
53 Returns a reference to the object. If the internal pointer is @NULL this
54 method will cause an assert in debug mode.
59 Returns pointer to its object or @NULL.
64 Assignment operator. Releases any previously held pointer
65 and creates a reference to @e ptr.
67 wxSharedPtrT
& operator operator=(T
* ptr
);
70 Reset pointer to @e ptr. If the reference count of the
71 previously owned pointer was 1 it will be deleted.
73 void reset(T
* ptr
= NULL
);
76 Returns @true if this is the only pointer pointing to its object.
81 Returns the number of pointers pointing to its object.
83 long use_count() const;