68#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
69#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
113 while (
p->next_ != ptr) {
114 assert(
p->next_ !=
this &&
115 "Trying to join() a linked ring we are already in. "
116 "Is GMock thread safety enabled?");
129 if (next_ ==
this)
return true;
131 while (
p->next_ !=
this) {
132 assert(
p->next_ != next_ &&
133 "Trying to depart() a linked ring we are not in. "
134 "Is GMock thread safety enabled?");
158 assert(&ptr !=
this);
182 T*
get()
const {
return value_; }
188 template <
typename U>
190 return value_ == ptr.
get();
192 template <
typename U>
194 return value_ != ptr.
get();
198 template <
typename U>
205 if (link_.
depart())
delete value_;
208 void capture(
T* ptr) {
216 link_.
join(&ptr->link_);
222template<
typename T>
inline
224 return ptr == x.
get();
227template<
typename T>
inline
229 return ptr != x.
get();
bool depart() GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex)
void join(linked_ptr_internal const *ptr) GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex)
linked_ptr & operator=(linked_ptr< U > const &ptr)
bool operator!=(T *p) const
bool operator!=(linked_ptr< U > const &ptr) const
linked_ptr & operator=(linked_ptr const &ptr)
linked_ptr(linked_ptr< U > const &ptr)
bool operator==(linked_ptr< U > const &ptr) const
linked_ptr(linked_ptr const &ptr)
bool operator==(T *p) const
#define GTEST_LOCK_EXCLUDED_(locks)
#define GTEST_DECLARE_STATIC_MUTEX_(mutex)
bool operator!=(T *ptr, const linked_ptr< T > &x)
linked_ptr< T > make_linked_ptr(T *ptr)
bool operator==(T *ptr, const linked_ptr< T > &x)
#define T(meth, val, expected)