Smart Pointers

ref_intrusive_policy Struct Reference

#include <smart_ptr.hpp>

List of all members.


Detailed Description

Use this policy to create an intrusive reference smart pointer. In general, this policy is faster than both ref_count_policy and ref_link_policy. However, it requires three intrusive functions that take the target type pointer as a parameter.
void intrusive_ptr_add_ref(T *);
void intrusive_ptr_release(T *);
bool intrusive_ptr_is_ref(T *);
Example implementation for intrusive functions:
void intrusive_ptr_add_ref(Shape * p){++(p->references);}
void intrusive_ptr_release(Shape * p){
if (--(p->references) == 0)
delete p;
}
bool intrusive_ptr_is_ref(Shape * p){return (p->references > 1);}

Example Usage.

void example_ref_intrusive_policy_usage()
{
}

Note:
The ref_link_policy can still be used in synchronized code, if intrusive_lock_policy is used.
See also:
smart_ptr, ref_count_policy, ref_link_policy

Definition at line 611 of file smart_ptr.hpp.

Public Member Functions

 ref_intrusive_policy ()
template<class T>
 ref_intrusive_policy (ref_intrusive_policy &, T &type)
template<class T, class F, class LCK>
void release (T &type, F, LCK &)
template<class T1, class F1, class T2, class F2, class LCK>
void assign (T1 &type1, F1 &clone_fct1, T2 type2, const F2 clone_fct2, ref_intrusive_policy &src_policy, LCK &lck_policy)

Protected Member Functions

template<class T>
bool is_referenced (T &type) const


The documentation for this struct was generated from the following file:
Generated on Wed Mar 29 21:58:59 2006 for Smart Pointers by  doxygen 1.4.6.Axter [Axter-Extended-Version]