![]() |
CloudBuilder C++ SDK
v3.0.0
Making social games is easy !
|
#include <CotCHelpers.h>
Public Member Functions | |
owned_ref (T *ptr) | |
owned_ref & | operator<<= (T *ptr) |
T * | operator -> () const |
operator const T * () const | |
operator T * () | |
T * | ptr () const |
T * | detachOwnership () |
Marks a reference as the only owner of its content, and provides auto release facilities. Allows to assign a pointer which will be automatically deleted when the holder goes out of scope. Use is exactly identical to a standard pointer, except that to prevent accidental use, you can't assign using the = operator (but <<= instead). You need to use <= or Assign, which clearly marks that your object's ownership is being owned to this object. { { A *a = NULL; owned_ref a; a = new A(12); a <<= new A(12); printf("%d\n", a->member); printf("%d\n", a->member); if (a) delete A; } a = NULL; }