delpi  0.0.1
DElta-complete LP solver
Loading...
Searching...
No Matches
delpi::SelfReferenceCountingObject Class Reference

Utility class to be inherited from to obtain compatibility with the intrusive_ptr. More...

#include <SelfReferenceCountingObject.hpp>

Inheritance diagram for delpi::SelfReferenceCountingObject:
delpi::ExpressionCell

Protected Member Functions

virtual ~SelfReferenceCountingObject ()=default
 Virtual destructor for the SelfReferenceCountingObject.

Private Attributes

std::size_t ref_count_ {0}
 Reference counter.

Detailed Description

Utility class to be inherited from to obtain compatibility with the intrusive_ptr.

It implements both AddRef and Release methods and supports both thread safe and unsafe reference counting. This class (and its subclasses) are meant to be initialised and used through an intrusive_ptr.

class MyClass : public SelfReferenceCountingObject {
public:
static intrusive_ptr New() { return intrusive_ptr new MyClass(); }
private:
MyClass() = default;
};
int main() {
const intrusive_ptr<MyClass> ptr{MyClass::New()};
}
Utility class to be inherited from to obtain compatibility with the intrusive_ptr.
Pointer to a generic object that supports intrusive reference counting.

Definition at line 34 of file SelfReferenceCountingObject.hpp.

Constructor & Destructor Documentation

◆ ~SelfReferenceCountingObject()

virtual delpi::SelfReferenceCountingObject::~SelfReferenceCountingObject ( )
protectedvirtualdefault

Virtual destructor for the SelfReferenceCountingObject.

Needed to ensure that the derived classes are deleted correctly.


The documentation for this class was generated from the following file: