Class documentation of Concepts

Loading...
Searching...
No Matches
sharedPointer_boost.hh
Go to the documentation of this file.
1
5#pragma once
6#include "boost/shared_ptr.hpp"
7#include "boost/weak_ptr.hpp"
8
9namespace concepts {
10
11 // ********************************************************** null_deleter **
12
14 {
15 void operator()(void const *) const
16 {
17 }
18 };
19
20 // ******************************************************************* RCP **
21
27 template<class T>
28 class RCP : public boost::shared_ptr<T>
29 {
30 public:
32 RCP() : boost::shared_ptr<T>() {}
33
46 explicit RCP(T* x) : boost::shared_ptr<T>(x) {}
47
48 RCP(boost::shared_ptr<T>& x) : boost::shared_ptr<T>(x) {}
49
50 template<class F>
51 RCP(const boost::shared_ptr<F>& x) : boost::shared_ptr<T>(x) {}
52
54 template<class F, class G>
55 RCP(F x, G y) : boost::shared_ptr<T>(x, y) {}
56
57 RCP<T>& operator=(const RCP<T> x)
58 {
59 RCP<T>(x).swap(*this);
60 return *this;
61 }
62
63 template<class F>
64 RCP<T>& operator=(const boost::shared_ptr<F> x)
65 {
66 RCP<T>(x).swap(*this);
67 return *this;
68 }
69
70 // this conversion operator is already implemented for shared_ptr
71 #if 0
72 // template function for implicit conversion ops.
73 template<class NewType>
74 operator RCP<NewType>()
75 {
76 return RCP<NewType>( boost::shared_ptr<NewType>(*this) );
77 }
78 #endif
79 };
80
81 // *************************************************************** makeRCP **
82
101 template <class T>
103 {
104 return RCP<T>(x);
105 }
106
107 // ********************************************************** makeRCP_weak **
108
121 template<class T>
123 {
124 return RCP<T>(x, null_deleter());
125 }
126
127#if 1
128 template<class T>
129 RCP<const T> makecRCP_weak(T* x) // create a const pointer
130 {
131 return RCP<const T>(x, null_deleter());
132 }
133#endif
134
135
136} // namespace concepts
RCP()
Default constructor.
RCP(F x, G y)
Constructor which includes the deleter G.
RCP< T > makeRCP(T *x)
RCP< T > makeRCP_weak(T *x)
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320