Skip to content

macro KFR_CLASS_REFCOUNT memory

KFR_CLASS_REFCOUNT(cl)                                                                               \
                                                                                                     public:                                                                                                      \
    void addref() const { m_refcount++; }                                                                    \
    void release() const                                                                                     \
    {                                                                                                        \
if (--m_refcount == 0)                                                                               \
{                                                                                                    \
    delete this;                                                                                     \
}                                                                                                    \
    }                                                                                                        \
                                                                                                     private:                                                                                                     \
    mutable std::atomic_uintptr_t m_refcount = ATOMIC_VAR_INIT(0);

Defined at meta/memory.hpp:299