00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00026 #ifndef HH_SENF_senf_Utils_pimpl_ptr_
00027 #define HH_SENF_senf_Utils_pimpl_ptr_ 1
00028
00029
00030 #include <algorithm>
00031 #include <boost/ptr_container/clone_allocator.hpp>
00032
00033
00034
00035
00036 namespace senf
00037 {
00038
00039 template<typename T, class CloneAllocator=boost::heap_clone_allocator>
00040 class pimpl_ptr
00041 {
00042 typedef void (*Deleter)(T* p);
00043 typedef T* (*Copier)(const T* p);
00044
00045 public:
00046 explicit pimpl_ptr(T* pointee);
00047 pimpl_ptr(const pimpl_ptr & rhs);
00048 ~pimpl_ptr() throw();
00049
00050 const T* get() const throw();
00051 T* get() throw();
00052
00053 const T* operator->() const throw();
00054 T* operator->() throw();
00055
00056 const T& operator*() const throw();
00057 T& operator*() throw();
00058
00059 void swap(pimpl_ptr& with) throw();
00060
00061 pimpl_ptr & operator=(const pimpl_ptr & rhs);
00062
00063 private:
00064 static Copier doCopy_;
00065 static Deleter doDelete_;
00066 T* p;
00067
00068 static void myDeleteFn(T* p);
00069 static T* myCopyFn(const T* p);
00070 };
00071
00072 }
00073
00074 namespace std
00075 {
00076 template<class T, class CloneAllocator>
00077 void swap(senf::pimpl_ptr<T,CloneAllocator>& lhs, senf::pimpl_ptr<T,CloneAllocator>& rhs)
00078 throw();
00079 }
00080
00081
00082
00083
00084 #include "pimpl_ptr.cti"
00085 #endif
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096