Ptr::Ptr

Ptr::Ptr
SF_INLINE Ptr();
SF_INLINE Ptr(C & robj);
SF_INLINE Ptr(Pickable<C> v);
SF_INLINE Ptr(Ptr<C>& other, PickType);
SF_INLINE Ptr(C * pobj);
SF_INLINE Ptr(const Ptr<C> & src);
template <class R> SF_INLINE Ptr(Ptr<R> & src);
template <class R> SF_INLINE Ptr(Pickable<R> v);
Description

The Ptr constructor initializes a new smart pointer object. The initialization is done slightly differently depending upon what value is passed to it.

  • Passing a valid object pointer (e.g., Object*) causes the constructor to increment the objects reference count and store a direct pointer to that object.
   if (pobj) pobj->AddRef(); pObject = pobj;
  • Passing a valid object reference (e.g., Object&) causes the constructor to assign a pointer to the object, but does not increment the objects reference count.
   pObject = &robj;
  • Passing a reference to another smart pointer object (e.g., Ptr<Object>&) will cause the constructor to copy the passed objects internal object pointer, incrementing the objects reference count if the object pointer is valid.
   if (pobj) pobj->AddRef(); pObject = pobj;
Parameters
Parameters 
Description 
C & robj 
A reference to a refcounted object. 
Pickable<C> v 
_nt_ 
Ptr<C>& other 
_nt_ 
C * pobj 
A pointer to a refcounted object. 
const Ptr<C> & src 
A reference to another Ptr object.