1 #ifndef XAPIAN_INCLUDED_INTRUSIVE_PTR_H
2 #define XAPIAN_INCLUDED_INTRUSIVE_PTR_H
39 #if !defined XAPIAN_IN_XAPIAN_H && !defined XAPIAN_LIB_BUILD
40 # error Never use <xapian/intrusive_ptr.h> directly; include <xapian.h> instead.
95 if(
px != 0 ) ++
px->_refs;
102 if(
px != 0 ) ++
px->_refs;
107 if(
px != 0 ) ++
px->_refs;
112 if(
px != 0 && --
px->_refs == 0 )
delete px;
115 #ifdef XAPIAN_MOVE_SEMANTICS
138 this_type(
static_cast< intrusive_ptr<U> &&
>( rhs ) ).
swap(*
this);
184 return a.
get() == b.
get();
189 return a.
get() != b.
get();
308 #ifdef XAPIAN_MOVE_SEMANTICS
335 this_type(
static_cast< opt_intrusive_ptr<U> &&
>( rhs ) ).
swap(*
this);
386 return a.
get() == b.
get();
391 return a.
get() != b.
get();
Base class for objects managed by intrusive_ptr.
intrusive_base()
Construct with no references.
void operator=(const intrusive_base &)
Prevent assignment.
intrusive_base(const intrusive_base &)
Prevent copying.
unsigned _refs
Reference count.
A smart pointer that uses intrusive reference counting.
intrusive_ptr(intrusive_ptr< U > const &rhs)
intrusive_ptr(intrusive_ptr const &rhs)
intrusive_ptr & operator=(intrusive_ptr const &rhs)
intrusive_ptr & operator=(T *rhs)
void swap(intrusive_ptr &rhs)
Base class for objects managed by opt_intrusive_ptr.
opt_intrusive_base()
Construct object which is initially not reference counted.
opt_intrusive_base & operator=(const opt_intrusive_base &)
void release() const
Start reference counting.
opt_intrusive_base(const opt_intrusive_base &)
unsigned _refs
Reference count.
virtual ~opt_intrusive_base()
A smart pointer that optionally uses intrusive reference counting.
opt_intrusive_ptr(opt_intrusive_ptr< U > const &rhs)
opt_intrusive_ptr & operator=(opt_intrusive_ptr const &rhs)
opt_intrusive_ptr this_type
void swap(opt_intrusive_ptr &rhs)
opt_intrusive_ptr(opt_intrusive_ptr const &rhs)
opt_intrusive_ptr & operator=(T *rhs)
bool operator!=(intrusive_ptr< T > const &a, intrusive_ptr< U > const &b)
bool operator==(intrusive_ptr< T > const &a, intrusive_ptr< U > const &b)
The Xapian namespace contains public interfaces for the Xapian library.
Define XAPIAN_VISIBILITY_* macros.
#define XAPIAN_VISIBILITY_DEFAULT