Boost logo

Boost :

Subject: [boost] [smart_ptr] Proposal to extract intrusive_ref_counter from Boost.Log
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-08-28 04:26:41


Hi,

I'd like to move intrusive_ref_counter class from Boost.Log to
Boost.SmartPtr. The class is intended to be used as a base class for a
user's class that is intended to be used with intrusive_ptr. The class
implements a reference counter and the related
intrusive_ptr_add_ref/intrusive_ptr_release operations, so the user doesn't
have to do that himself. Usage example:

  class my_class :
    public intrusive_ref_counter
  {
  };

  intrusive_ptr< my_class > p = new my_class();

Besides just simplifying intrusive_ptr usage, the base class can be used as
a sort of "void" as in shared_ptr< void >. I.e. intrusive_ptr<
intrusive_ref_counter > can refer to object of any class that follows this
protocol.

Implementation: boost/log/utility/intrusive_ref_counter.hpp


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk