Boost logo

Boost Users :

From: Alexander (gutenev_at_[hidden])
Date: 2008-08-01 06:19:42


I did not do that, because shared_ptr does not.
Counter should be a part of policy too, like:

struct trivial_increment_policy {
    void inc( ) { ++c; }
    bool dec( ) { return --c == 0; }
    size_t c;
}

template<class Derived, template IncrementPolicy=trivial_increment_policy>
class intrusive_pointee_base
{
private:
  typedef intrusive_pointee_base self;

protected:
  intrusive_pointee_base(void) : reference_counter_() {}
  intrusive_pointee_base(self const&) : reference_counter_() {}
  self& operator=(self const&) { return *this }
  ~intrusive_pointee_base(void) {}

  mutable reference_counter_;
};


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net