49 #ifndef CARTOBASE_SMART_WEAKPTR_H 50 #define CARTOBASE_SMART_WEAKPTR_H 73 #if !defined( CARTO_NO_MEMBER_TEMPLATES ) && \ 74 !defined( CARTO_NO_MEMBER_TEMPLATE_FRIENDS ) 78 #if defined( CARTO_BROKEN_FRIEND_TEMPLATE_FUNCTION ) 79 template <
typename U,
typename V>
82 template <
typename U,
typename V >
86 #ifndef DOXYGEN_HIDE_INTERNAL_CLASSES 87 class InsipidProxyPointer
90 void operator delete(
void* );
91 void operator delete[](
void* );
100 pointee->attachWeakPtr( *
this );
109 pointee->detachWeakPtr( *
this );
114 r->attachWeakPtr( *
this );
120 #if !defined( CARTO_NO_MEMBER_TEMPLATES ) 122 template <
typename Y>
126 pointee->attachWeakPtr( *
this );
129 template <
typename Y>
133 pointee->attachWeakPtr( *
this );
136 template <
typename Y>
137 explicit weak_ptr(
const std::unique_ptr<Y>& r ) : pointee( r.
get() )
140 pointee->attachWeakPtr( *
this );
143 template <
typename Y>
150 template <
typename Y>
157 template <
typename Y>
169 pointee->attachWeakPtr( *
this );
172 explicit weak_ptr(
const std::unique_ptr<T>& r ) : pointee( r.get() )
175 pointee->attachWeakPtr( *
this );
195 pointee->attachWeakPtr( *
this );
207 pointee->detachWeakPtr( *
this );
210 #ifndef DOXYGEN_HIDE_INTERNAL_CLASSES 211 operator InsipidProxyPointer*()
const 213 return reinterpret_cast<InsipidProxyPointer*
>( pointee );
235 pointee->detachWeakPtr( *
this );
242 {
return pointee == x.
get(); }
244 {
return pointee == x.
get(); }
246 {
return pointee == x.
get(); }
248 {
return pointee == x.
get(); }
250 {
return pointee != x.
get(); }
252 {
return pointee != x.
get(); }
254 {
return pointee != x.
get(); }
256 {
return pointee != x.
get(); }
257 bool operator < ( const weak_ptr<T> & x )
const 258 {
return pointee < x.get(); }
259 bool operator < ( const weak_shared_ptr<T> & x )
const 260 {
return pointee < x.get(); }
261 bool operator < ( const shared_ptr<T> & x )
const 262 {
return pointee < x.get(); }
263 bool operator < ( const rc_ptr<T> & x )
const 264 {
return pointee < x.get(); }
273 #if defined( CARTO_NO_MEMBER_TEMPLATES) || \ 274 !defined( CARTO_NO_MEMBER_TEMPLATE_FRIENDS ) 288 template <
typename T,
typename U>
292 return weak_ptr<U>(
dynamic_cast<U*
>( r.pointee ) );
Observer pointer, observing a shfj::WeakObject.
A multi-purpose general smart pointer, which can act as either a rc_ptr, a weak_ptr or a weak_shared_...
weak_ptr(const rc_ptr< Y > &r)
bool operator!=(const weak_ptr< T > &x) const
weak_shared_ptr: increments a reference count, is told and becomes null whenever the shared object is...
weak_ptr(const std::unique_ptr< Y > &r)
Reference-counting pointer.
weak_ptr & operator=(const std::unique_ptr< Y > &r)
friend weak_ptr< V > weak_cast(const weak_ptr< U > &)
weak_ptr & operator=(const weak_ptr &w)
Base class for weakly referenced objects.
weak_ptr(const weak_ptr &r)
weak_ptr & operator=(const rc_ptr< Y > &r)
weak_ptr & operator=(const weak_ptr< Y > &r)
weak_ptr< U > weak_cast(const weak_ptr< T > &)
weak_ptr(const weak_ptr< Y > &r)
bool operator==(const weak_ptr< T > &x) const