Include file:

#include "mcrl2/utilities/shared_reference.h
class mcrl2::utilities::shared_reference

A reference counted reference to a shared_reference_counted object.

Similar to a shared_ptr except that reference counts are only atomic when thread safety is desired and that it stores the reference count in the inherited object.

Private attributes

utilities::tagged_pointer<T> mcrl2::utilities::shared_reference::m_reference

Public member functions

bool defined() const

Check whether the shared_reference has a valid reference.

T *get() const noexcept
bool operator!=(const shared_reference<T> &other) const noexcept
T &operator*() const noexcept
T *operator->() const noexcept
bool operator<(const shared_reference<T> &other) const noexcept
bool operator<=(const shared_reference<T> &other) const noexcept
shared_reference<T> &operator=(const shared_reference<T> &other) noexcept

Copy assignment constructor.

shared_reference<T> &operator=(shared_reference<T> &&other) noexcept

Move assignment constructor.

bool operator==(const shared_reference<T> &other) const noexcept
bool operator>(const shared_reference<T> &other) const noexcept
bool operator>=(const shared_reference &other) const noexcept
shared_reference() noexcept

The default constructor.

shared_reference(const shared_reference<T> &other) noexcept

Copy constructor.

shared_reference(shared_reference<T> &&other) noexcept

Move constructor.

shared_reference(T *reference) noexcept

Takes ownership of the passed reference, which means that its reference count is incremented.

void swap(shared_reference<T> &other)

Swaps *this with the other shared reference.

Prevents the change of any reference count adaptations

void tag() const
bool tagged() const noexcept
void untag() const