diff -r c513ef40773e -r 563aea5eba06 include/am-refcounting.h --- a/include/am-refcounting.h Thu Aug 29 23:51:30 2013 -0700 +++ b/include/am-refcounting.h Sat Aug 31 19:52:41 2013 -0700 @@ -58,6 +58,13 @@ mutable T *thing_; }; +template +static inline Newborn +NoAddRef(T *t) +{ + return Newborn(t); +} + // When returning a value, we'd rather not be needlessly changing the refcount, // so we have a special type to use for returns. template @@ -191,9 +198,9 @@ AddRef(); } Ref(Moveable other) - : thing_(other.thing_) + : thing_(other->thing_) { - other.thing_ = NULL; + other->thing_ = NULL; } template Ref(const Ref &other) @@ -261,6 +268,13 @@ return *this; } + Ref &operator =(Moveable other) { + Release(); + thing_ = other->thing_; + other->thing_ = NULL; + return *this; + } + private: void AddRef() { if (thing_)