Chromium Code Reviews| Index: Source/wtf/RefPtr.h |
| diff --git a/Source/wtf/RefPtr.h b/Source/wtf/RefPtr.h |
| index f640a7713070a8d5afe9dfd7513025056ce8cba7..e8e9940e28ac52e9735573e5bb938c7378d9e739 100644 |
| --- a/Source/wtf/RefPtr.h |
| +++ b/Source/wtf/RefPtr.h |
| @@ -163,6 +163,16 @@ namespace WTF { |
| return a == b.get(); |
| } |
| + template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, const U& b) |
|
Mikhail
2014/05/07 12:34:28
I would not like us to implicitly compare RefPtr w
Mads Ager (chromium)
2014/05/07 12:40:09
It will not (compile-time error because of ambigui
tkent
2014/05/07 14:11:05
I also have a concern about adding the generic ver
|
| + { |
| + return a.get() == &b; |
| + } |
| + |
| + template<typename T, typename U> inline bool operator==(const T& a, const RefPtr<U>& b) |
| + { |
| + return &a == b.get(); |
| + } |
| + |
| template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, const RefPtr<U>& b) |
| { |
| return a.get() != b.get(); |
| @@ -178,6 +188,16 @@ namespace WTF { |
| return a != b.get(); |
| } |
| + template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, const U& b) |
| + { |
| + return a.get() != &b; |
| + } |
| + |
| + template<typename T, typename U> inline bool operator!=(const T& a, const RefPtr<U>& b) |
| + { |
| + return &a != b.get(); |
| + } |
| + |
| template<typename T, typename U> inline RefPtr<T> static_pointer_cast(const RefPtr<U>& p) |
| { |
| return RefPtr<T>(static_cast<T*>(p.get())); |