Class Reference::Able

class Able : public Reference::HeapTracked

Combined with the Reference::To template class, this class may be used to eliminate both memory leaks and dangling references. Simply inherit this class as follows:

class myKlass : public Reference::Able { … };

myKlass can now be managed using a Reference::To<myKlass>.

Subclassed by Alias, Callback< Type >, FunctorBase, TextEditor< T >, TextIndex, TextInterface::Name, TextInterface::Parser, TextInterface::Value, TextLoop

Public Functions

Able()

Default constructor.

Able(const Able&)

Copy constructor.

Able &operator=(const Able&)

Assignment operator.

virtual ~Able()

Destructor.

inline unsigned get_reference_count() const

Returns the number of references there are to this.

Public Static Functions

static size_t get_instance_count()

Returns the current number instances in existence.

class Handle

Manages a pointer to a Reference::Able object.

Reference::To smart pointers share a single Handle that points to a Reference::Able object.

Public Functions

Handle()

Default constructor.

~Handle()

Destructor.

void decrement(bool active, bool auto_delete)

Thread-safe decrement and delete.

Public Members

Able *pointer = nullptr

Pointer to Able instance.

unsigned handle_count = 0

Count of all references to this handle.

Public Static Functions

static void copy(Handle *&to, Handle *const &from, bool active)

Thread-safe copy and increment.