1#ifndef _H_intrusive_ptr_base_
2#define _H_intrusive_ptr_base_
6#include <boost/smart_ptr/intrusive_ptr.hpp>
7#include <boost/checked_delete.hpp>
8#include <boost/detail/atomic_count.hpp>
13 class intrusive_ptr_base {
17 intrusive_ptr_base() : ref_count(0) {
22 intrusive_ptr_base(intrusive_ptr_base<T>
const &) : ref_count(0) {
28 intrusive_ptr_base &operator=(intrusive_ptr_base
const &rhs) {
34 friend void intrusive_ptr_add_ref(intrusive_ptr_base<T>
const *s) {
37 assert(s->ref_count >= 0);
44 friend void intrusive_ptr_release(intrusive_ptr_base<T>
const *s) {
47 assert(s->ref_count > 0);
49 if (--s->ref_count == 0)
50 boost::checked_delete(
static_cast<T
const *
>(s));
53 boost::intrusive_ptr<T> self() {
54 return boost::intrusive_ptr<T>((T * )
58 boost::intrusive_ptr<const T> self()
const {
59 return boost::intrusive_ptr<const T>((T
const*)
this);
62 int refcount()
const {
68 mutable boost::detail::atomic_count ref_count;
Definition Accessor.hpp:12