OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BASE_MOVE_H_ | |
6 #define BASE_MOVE_H_ | |
7 | |
8 // TODO(dcheng): Remove this header. | |
9 #include <utility> | |
10 | |
11 #include "base/compiler_specific.h" | |
12 #include "base/macros.h" | |
13 #include "build/build_config.h" | |
14 | |
15 // TODO(crbug.com/566182): DEPRECATED! | |
16 // Use DISALLOW_COPY_AND_ASSIGN instead, or if your type will be used in | |
17 // Callbacks, use DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND instead. | |
18 #define MOVE_ONLY_TYPE_FOR_CPP_03(type) \ | |
19 DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(type) | |
20 | |
21 // A macro to disallow the copy constructor and copy assignment functions. | |
22 // This should be used in the private: declarations for a class. | |
23 // | |
24 // Use this macro instead of DISALLOW_COPY_AND_ASSIGN if you want to pass | |
25 // ownership of the type through a base::Callback without heap-allocating it | |
26 // into a scoped_ptr. The class must define a move constructor and move | |
27 // assignment operator to make this work. | |
28 // | |
29 // This version of the macro adds a cryptic MoveOnlyTypeForCPP03 typedef for the | |
30 // base::Callback implementation to use. See IsMoveOnlyType template and its | |
31 // usage in base/callback_internal.h for more details. | |
32 // TODO(crbug.com/566182): Remove this macro and use DISALLOW_COPY_AND_ASSIGN | |
33 // everywhere instead. | |
34 #define DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(type) \ | |
35 private: \ | |
36 type(const type&) = delete; \ | |
37 void operator=(const type&) = delete; \ | |
38 \ | |
39 public: \ | |
40 typedef void MoveOnlyTypeForCPP03; \ | |
41 \ | |
42 private: | |
43 | |
44 #endif // BASE_MOVE_H_ | |
OLD | NEW |