Lines Matching refs:ptr
108 void join(linked_ptr_internal const* ptr)
112 linked_ptr_internal const* p = ptr;
113 while (p->next_ != ptr) {
120 next_ = ptr;
152 explicit linked_ptr(T* ptr = NULL) { capture(ptr); }
156 template <typename U> linked_ptr(linked_ptr<U> const& ptr) { copy(&ptr); }
157 linked_ptr(linked_ptr const& ptr) { // NOLINT
158 assert(&ptr != this);
159 copy(&ptr);
163 template <typename U> linked_ptr& operator=(linked_ptr<U> const& ptr) {
165 copy(&ptr);
169 linked_ptr& operator=(linked_ptr const& ptr) {
170 if (&ptr != this) {
172 copy(&ptr);
178 void reset(T* ptr = NULL) {
180 capture(ptr);
189 bool operator==(linked_ptr<U> const& ptr) const {
190 return value_ == ptr.get();
193 bool operator!=(linked_ptr<U> const& ptr) const {
194 return value_ != ptr.get();
208 void capture(T* ptr) {
209 value_ = ptr;
213 template <typename U> void copy(linked_ptr<U> const* ptr) {
214 value_ = ptr->get();
216 link_.join(&ptr->link_);
223 bool operator==(T* ptr, const linked_ptr<T>& x) {
224 return ptr == x.get();
228 bool operator!=(T* ptr, const linked_ptr<T>& x) {
229 return ptr != x.get();
236 linked_ptr<T> make_linked_ptr(T* ptr) {
237 return linked_ptr<T>(ptr);