Lines Matching refs:T

26 template<typename T> class wp;
30 template<typename T>
51 static inline sp<T> make(Args&&... args);
57 static inline sp<T> fromExisting(T* other);
64 sp(T* other); // NOLINT(implicit)
67 sp& operator=(T* other);
72 sp(const sp<T>& other);
73 sp(sp<T>&& other) noexcept;
82 static inline sp<T> cast(const sp<U>& other);
88 sp& operator = (const sp<T>& other);
89 sp& operator=(sp<T>&& other) noexcept;
95 void force_set(T* other);
103 inline T& operator* () const { return *m_ptr; }
104 inline T* operator-> () const { return m_ptr; }
105 inline T* get() const { return m_ptr; } in get()
122 void set_pointer(T* ptr);
123 T* m_ptr;
127 template <typename T, typename U> \
128 static inline bool operator _op_(const sp<T>& t, const sp<U>& u) { \
131 template <typename T, typename U> \
132 static inline bool operator _op_(const T* t, const sp<U>& u) { \
135 template <typename T, typename U> \
136 static inline bool operator _op_(const sp<T>& t, const U* u) { \
139 template <typename T> \
140 static inline bool operator _op_(const sp<T>& t, std::nullptr_t) { \
143 template <typename T> \
144 static inline bool operator _op_(std::nullptr_t, const sp<T>& t) { \
148 template <template <typename C> class comparator, typename T, typename U>
149 static inline bool _sp_compare_(T* a, U* b) { in _sp_compare_()
150 return comparator<typename std::common_type<T*, U*>::type>()(a, b); in _sp_compare_()
154 template <typename T, typename U> \
155 static inline bool operator _op_(const sp<T>& t, const sp<U>& u) { \
158 template <typename T, typename U> \
159 static inline bool operator _op_(const T* t, const sp<U>& u) { \
162 template <typename T, typename U> \
163 static inline bool operator _op_(const sp<T>& t, const U* u) { \
166 template <typename T> \
167 static inline bool operator _op_(const sp<T>& t, std::nullptr_t) { \
170 template <typename T> \
171 static inline bool operator _op_(std::nullptr_t, const sp<T>& t) { \
193 template <typename T>
195 sp<T> sp<T>::make(Args&&... args) { in make()
196 T* t = new T(std::forward<Args>(args)...); in make()
197 sp<T> result; in make()
203 template <typename T>
204 sp<T> sp<T>::fromExisting(T* other) { in fromExisting()
207 sp<T> result; in fromExisting()
215 template<typename T>
216 sp<T>::sp(T* other) in sp()
223 template <typename T>
225 sp<T>::sp(U* other) : m_ptr(other) { in sp()
227 (static_cast<T*>(other))->incStrong(this); in sp()
231 template <typename T>
232 sp<T>& sp<T>::operator=(T* other) {
233 T* oldPtr(*const_cast<T* volatile*>(&m_ptr));
238 if (oldPtr != *const_cast<T* volatile*>(&m_ptr)) sp_report_race();
244 template<typename T>
245 sp<T>::sp(const sp<T>& other) in sp()
251 template <typename T>
252 sp<T>::sp(sp<T>&& other) noexcept : m_ptr(other.m_ptr) { in sp()
256 template<typename T> template<typename U>
257 sp<T>::sp(const sp<U>& other) in sp()
263 template<typename T> template<typename U>
264 sp<T>::sp(sp<U>&& other) in sp()
269 template <typename T>
271 sp<T> sp<T>::cast(const sp<U>& other) { in cast()
272 return sp<T>::fromExisting(static_cast<T*>(other.get())); in cast()
275 template<typename T>
276 sp<T>::~sp() { in ~sp()
281 template<typename T>
282 sp<T>& sp<T>::operator =(const sp<T>& other) {
284 T* oldPtr(*const_cast<T* volatile*>(&m_ptr));
285 T* otherPtr(other.m_ptr);
288 if (oldPtr != *const_cast<T* volatile*>(&m_ptr)) sp_report_race();
293 template <typename T>
294 sp<T>& sp<T>::operator=(sp<T>&& other) noexcept {
295 T* oldPtr(*const_cast<T* volatile*>(&m_ptr));
297 if (oldPtr != *const_cast<T* volatile*>(&m_ptr)) sp_report_race();
303 template<typename T> template<typename U>
304 sp<T>& sp<T>::operator =(const sp<U>& other) {
305 T* oldPtr(*const_cast<T* volatile*>(&m_ptr));
306 T* otherPtr(other.m_ptr);
309 if (oldPtr != *const_cast<T* volatile*>(&m_ptr)) sp_report_race();
314 template<typename T> template<typename U>
315 sp<T>& sp<T>::operator =(sp<U>&& other) {
316 T* oldPtr(*const_cast<T* volatile*>(&m_ptr));
318 if (oldPtr != *const_cast<T* volatile*>(&m_ptr)) sp_report_race();
325 template<typename T> template<typename U>
326 sp<T>& sp<T>::operator =(U* other) {
327 T* oldPtr(*const_cast<T* volatile*>(&m_ptr));
328 if (other) (static_cast<T*>(other))->incStrong(this);
330 if (oldPtr != *const_cast<T* volatile*>(&m_ptr)) sp_report_race();
336 template<typename T>
337 void sp<T>::force_set(T* other) { in force_set()
342 template<typename T>
343 void sp<T>::clear() { in clear()
344 T* oldPtr(*const_cast<T* volatile*>(&m_ptr)); in clear()
347 if (oldPtr != *const_cast<T* volatile*>(&m_ptr)) sp_report_race(); in clear()
352 template<typename T>
353 void sp<T>::set_pointer(T* ptr) { in set_pointer()