IMP logo
IMP Reference Guide  develop.549d75e6f4,2024/11/20
The Integrative Modeling Platform
IMP::WeakPointer< O > Struct Template Reference

Smart pointer to Object-derived classes that does not refcount. More...

#include <IMP/WeakPointer.h>

+ Inheritance diagram for IMP::WeakPointer< O >:

Detailed Description

template<class O>
struct IMP::WeakPointer< O >

Smart pointer to Object-derived classes that does not refcount.

WeakPointers do not do reference counting and do not claim ownership of the pointed object. As a result, they can be used to break cycles in reference counted pointers. For example, since an IMP::Model contains a reference counted pointer to an IMP::Particle, the IMP::Particle has a WeakPointer back to the Model.

This version of a WeakPointer only works on complete types, but adds additional checks of correct usage (eg that the Object has not been previously freed) compared to UncheckedWeakPointer.

See Also
UncheckedWeakPointer

Definition at line 77 of file WeakPointer.h.

Public Types

typedef
IMP::internal::PointerBase
< IMP::internal::CheckedWeakPointerTraits
< O > > 
P
 

Public Member Functions

template<class Any >
 WeakPointer (const Any &o)
 
template<class OT >
WeakPointer< O > & operator= (const IMP::internal::PointerBase< OT > &o)
 
template<class OT >
WeakPointer< O > & operator= (OT *o)
 
WeakPointer< O > & operator= (const P &o)
 

The documentation for this struct was generated from the following file: