Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tools/clang/rewrite_scoped_refptr/tests/scoped_refptr.h

Issue 1385193002: Bisect clang Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 246985 Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SCOPED_REFPTR_H_
6 #define SCOPED_REFPTR_H_
7
8 // Stub scoped_refptr<T> class that supports an implicit cast to T*.
9 template <class T>
10 class scoped_refptr {
11 public:
12 typedef T element_type;
13 scoped_refptr() : ptr_(0) {}
14 scoped_refptr(T* p) : ptr_(p) {}
15 scoped_refptr(const scoped_refptr<T>& r) : ptr_(r.ptr_) {}
16
17 template <typename U>
18 scoped_refptr(const scoped_refptr<U>& r)
19 : ptr_(r.get()) {}
20
21 ~scoped_refptr() {}
22
23 T* get() const { return ptr_; }
24 operator T*() const { return ptr_; }
25 T* operator->() const { return ptr_; }
26
27 scoped_refptr<T>& operator=(T* p) {
28 ptr_ = p;
29 return *this;
30 }
31 scoped_refptr<T>& operator=(const scoped_refptr<T>& r) {
32 return *this = r.ptr_;
33 }
34 template <typename U>
35 scoped_refptr<T>& operator=(const scoped_refptr<U>& r) {
36 return *this = r.get();
37 }
38
39 protected:
40 T* ptr_;
41 };
42
43 #endif // SCOPED_REFPTR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698