OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr& o) | 104 template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr& o) |
105 { | 105 { |
106 RefPtr ptr = o; | 106 RefPtr ptr = o; |
107 swap(ptr); | 107 swap(ptr); |
108 return *this; | 108 return *this; |
109 } | 109 } |
110 | 110 |
111 #if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) | 111 #if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) |
112 template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(RefPtr&& o) | 112 template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(RefPtr&& o) |
113 { | 113 { |
114 swap(o); | 114 // FIXME: Instead of explicitly casting to RefPtr&& here, we should use
std::move, but that requires us to |
| 115 // have a standard library that supports move semantics. |
| 116 RefPtr ptr = static_cast<RefPtr&&>(o); |
| 117 swap(ptr); |
115 return *this; | 118 return *this; |
116 } | 119 } |
117 #endif | 120 #endif |
118 | 121 |
119 template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::opera
tor=(const RefPtr<U>& o) | 122 template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::opera
tor=(const RefPtr<U>& o) |
120 { | 123 { |
121 RefPtr ptr = o; | 124 RefPtr ptr = o; |
122 swap(ptr); | 125 swap(ptr); |
123 return *this; | 126 return *this; |
124 } | 127 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 private: | 215 private: |
213 T* m_ptr; | 216 T* m_ptr; |
214 }; | 217 }; |
215 | 218 |
216 } // namespace WTF | 219 } // namespace WTF |
217 | 220 |
218 using WTF::RefPtr; | 221 using WTF::RefPtr; |
219 using WTF::static_pointer_cast; | 222 using WTF::static_pointer_cast; |
220 | 223 |
221 #endif // WTF_RefPtr_h | 224 #endif // WTF_RefPtr_h |
OLD | NEW |