Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_MOVE_H_ | 5 #ifndef BASE_MOVE_H_ |
| 6 #define BASE_MOVE_H_ | 6 #define BASE_MOVE_H_ |
| 7 | 7 |
| 8 // Macro with the boilerplate that makes a type move-only in C++03. | 8 // Macro with the boilerplate that makes a type move-only in C++03. |
| 9 // | 9 // |
| 10 // USAGE | 10 // USAGE |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 type* object; \ | 208 type* object; \ |
| 209 }; \ | 209 }; \ |
| 210 type(type&); \ | 210 type(type&); \ |
| 211 void operator=(type&); \ | 211 void operator=(type&); \ |
| 212 public: \ | 212 public: \ |
| 213 operator rvalue_type() { return rvalue_type(this); } \ | 213 operator rvalue_type() { return rvalue_type(this); } \ |
| 214 type Pass() { return type(rvalue_type(this)); } \ | 214 type Pass() { return type(rvalue_type(this)); } \ |
| 215 typedef void MoveOnlyTypeForCPP03; \ | 215 typedef void MoveOnlyTypeForCPP03; \ |
| 216 private: | 216 private: |
| 217 | 217 |
| 218 #define MOVE_ONLY_TYPE_FOR_CPP_03_WITH_MOVE_CONSTRUCTOR(type) \ | |
| 219 private: \ | |
| 220 type(type&); \ | |
| 221 void operator=(type&); \ | |
| 222 public: \ | |
| 223 typedef void MoveOnlyTypeForCPP03; \ | |
| 224 type&& Pass() { return static_cast<type&&>(*this); } \ | |
|
jamesr
2014/09/26 20:22:45
no, this is not something we should add as a gener
danakj
2014/09/26 20:57:52
Why? It's only useful if they also add a T&& const
| |
| 225 private: | |
| 226 | |
| 218 #endif // BASE_MOVE_H_ | 227 #endif // BASE_MOVE_H_ |
| OLD | NEW |