template <typename T, bool EnableAdoptionValidator = ZX_DEBUG_ASSERT_IMPLEMENTED>
class RefCounted
Defined at line 35 of file ../../zircon/system/ulib/fbl/include/fbl/ref_counted.h
Base class for a reference counted type. Use as
class Handle : public RefCounted
<Handle
> {
};
This supports intrusive atomic reference counting with adoption. This means
that a new object starts life at a reference count of 1 and has to be adopted
by a type (such as a fbl::RefPtr) that begins manipulation of the reference
count. If the reference count ever reaches zero, the object's lifetime is
over and it should be destroyed (Release() returns true if this is the case).
You might be wondering about the unused |T| template parameter. It exists so
that the base class of the derived object is a unique type. Without being a
template then you can have many unrelated classes which can be implicitly
upcasted to RefCounted* which is an undesirable situation for a mixin class
like this one. Specially because the destructor is not virtual. The same is
not possible via internal::RefCountedBase since the ctor and dtor are
protected.
Public Methods
void RefCounted<T, EnableAdoptionValidator> ()
Defined at line 37 of file ../../zircon/system/ulib/fbl/include/fbl/ref_counted.h
void ~RefCounted<T, EnableAdoptionValidator> ()
Defined at line 38 of file ../../zircon/system/ulib/fbl/include/fbl/ref_counted.h
void RefCounted<T, EnableAdoptionValidator> (const RefCounted<T, EnableAdoptionValidator> & )
RefCounted
<
> instances may not be copied, assigned or moved.
Defined at line 47 of file ../../zircon/system/ulib/fbl/include/fbl/ref_counted.h
void RefCounted<T, EnableAdoptionValidator> (RefCounted<T, EnableAdoptionValidator> && )
RefCounted
<
> instances may not be copied, assigned or moved.
Defined at line 47 of file ../../zircon/system/ulib/fbl/include/fbl/ref_counted.h
RefCounted<T, EnableAdoptionValidator> & operator= (const RefCounted<T, EnableAdoptionValidator> & )
RefCounted
<
> instances may not be copied, assigned or moved.
Defined at line 47 of file ../../zircon/system/ulib/fbl/include/fbl/ref_counted.h
RefCounted<T, EnableAdoptionValidator> & operator= (RefCounted<T, EnableAdoptionValidator> && )
RefCounted
<
> instances may not be copied, assigned or moved.
Defined at line 47 of file ../../zircon/system/ulib/fbl/include/fbl/ref_counted.h