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

Side by Side Diff: base/move.h

Issue 1450013002: styleguide: Allow std::move for move semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added discussion thread link Created 5 years, 1 month 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
« no previous file with comments | « no previous file | styleguide/c++/c++11.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <utility>
9
8 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
9 11
10 // Macro with the boilerplate that makes a type move-only in C++03. 12 // Macro with the boilerplate that makes a type move-only in C++03.
11 // 13 //
12 // USAGE 14 // USAGE
13 // 15 //
14 // This macro should be used instead of DISALLOW_COPY_AND_ASSIGN to create 16 // This macro should be used instead of DISALLOW_COPY_AND_ASSIGN to create
15 // a "move-only" type. Unlike DISALLOW_COPY_AND_ASSIGN, this macro should be 17 // a "move-only" type. Unlike DISALLOW_COPY_AND_ASSIGN, this macro should be
16 // the first line in a class declaration. 18 // the first line in a class declaration.
17 // 19 //
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 operator rvalue_type() { return rvalue_type(this); } \ 217 operator rvalue_type() { return rvalue_type(this); } \
216 type Pass() WARN_UNUSED_RESULT { return type(rvalue_type(this)); } \ 218 type Pass() WARN_UNUSED_RESULT { return type(rvalue_type(this)); } \
217 typedef void MoveOnlyTypeForCPP03; \ 219 typedef void MoveOnlyTypeForCPP03; \
218 private: 220 private:
219 221
220 #define MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(type) \ 222 #define MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(type) \
221 private: \ 223 private: \
222 type(const type&); \ 224 type(const type&); \
223 void operator=(const type&); \ 225 void operator=(const type&); \
224 public: \ 226 public: \
225 type&& Pass() WARN_UNUSED_RESULT { return static_cast<type&&>(*this); } \ 227 type&& Pass() WARN_UNUSED_RESULT { return std::move(*this); } \
226 typedef void MoveOnlyTypeForCPP03; \ 228 typedef void MoveOnlyTypeForCPP03; \
227 private: 229 private:
228 230
229 #define TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(type) \ 231 #define TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(type) \
230 public: \ 232 public: \
231 type&& Pass() WARN_UNUSED_RESULT { return static_cast<type&&>(*this); } \ 233 type&& Pass() WARN_UNUSED_RESULT { return std::move(*this); } \
232 private: 234 private:
233 235
234 #endif // BASE_MOVE_H_ 236 #endif // BASE_MOVE_H_
OLDNEW
« no previous file with comments | « no previous file | styleguide/c++/c++11.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698