boost::log::intrusive_ref_counter — A reference counter base class.
// In header: <boost/log/utility/intrusive_ref_counter.hpp> class intrusive_ref_counter { public: // construct/copy/destruct intrusive_ref_counter(); intrusive_ref_counter(intrusive_ref_counter const &); intrusive_ref_counter& operator=(intrusive_ref_counter const &); ~intrusive_ref_counter(); // public member functions unsigned long use_count() const; };
This base class can be used with user-defined classes to add support for intrusive_ptr
. The class contains a thread-safe reference counter and a virtual destructor, which makes the derived class polymorphic. Upon releasing the last intrusive_ptr
referencing the object derived from the intrusive_ref_counter
class, operator delete
is automatically called on the pointer to the object.
intrusive_ref_counter
public
construct/copy/destructintrusive_ref_counter();
Default constructor
Postconditions: |
|
intrusive_ref_counter(intrusive_ref_counter const &);
Copy constructor
Postconditions: |
|
intrusive_ref_counter& operator=(intrusive_ref_counter const &);
Assignment
Postconditions: | The reference counter is not modified after assignment |
~intrusive_ref_counter();
Virtual destructor