[Boost-bugs] [Boost C++ Libraries] #1109: intrusive_ptr needs a helper base class

Subject: [Boost-bugs] [Boost C++ Libraries] #1109: intrusive_ptr needs a helper base class
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-07-21 23:33:33


#1109: intrusive_ptr needs a helper base class
------------------------------+---------------------------------------------
 Reporter: pdimov | Owner:
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: smart_ptr
  Version: | Severity: Problem
 Keywords: |
------------------------------+---------------------------------------------
 http://lists.boost.org/Archives/boost/2006/04/103182.php
 http://lists.boost.org/Archives/boost/2006/04/103203.php
 http://lists.boost.org/Archives/boost/2006/04/103267.php
 http://lists.boost.org/Archives/boost/2006/04/103273.php
 {{{
 class counted_base
 {
 private:

     mutable detail::atomic_count count_;

 protected:

     counted_base(): count_( 0 ) {}
     virtual ~counted_base() {}
     counted_base( counted_base const & ): count_( 0 ) {}
     counted_base& operator=( counted_base const & ) { return *this; }

 public:

     inline friend void intrusive_ptr_add_ref( counted_base const * p )
     {
         ++p->count_;
     }

     inline friend void intrusive_ptr_release( counted_base const * p )
     {
         if( --p->count_ == 0 ) delete p;
     }

     long use_count() const { return count_; }
 };
 }}}
 http://lists.boost.org/Archives/boost/2006/04/103306.php

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1109>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:56 UTC