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

Side by Side Diff: mojo/public/cpp/system/macros.h

Issue 1352683002: Make the suppressed copy/assignment operators in MOJO_MOVE_ONLY_TYPE take const refs. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 months 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // Define a set of C++ specific macros. 5 // Define a set of C++ specific macros.
6 // Mojo C++ API users can assume that mojo/public/cpp/system/macros.h 6 // Mojo C++ API users can assume that mojo/public/cpp/system/macros.h
7 // includes mojo/public/c/system/macros.h. 7 // includes mojo/public/c/system/macros.h.
8 8
9 #ifndef MOJO_PUBLIC_CPP_SYSTEM_MACROS_H_ 9 #ifndef MOJO_PUBLIC_CPP_SYSTEM_MACROS_H_
10 #define MOJO_PUBLIC_CPP_SYSTEM_MACROS_H_ 10 #define MOJO_PUBLIC_CPP_SYSTEM_MACROS_H_
(...skipping 17 matching lines...) Expand all
28 #endif 28 #endif
29 } // namespace internal 29 } // namespace internal
30 } // namespace mojo 30 } // namespace mojo
31 #define MOJO_ARRAYSIZE(array) (sizeof(::mojo::internal::ArraySizeHelper(array))) 31 #define MOJO_ARRAYSIZE(array) (sizeof(::mojo::internal::ArraySizeHelper(array)))
32 32
33 // Used to make a type move-only. See Chromium's base/move.h for more 33 // Used to make a type move-only. See Chromium's base/move.h for more
34 // details. The MoveOnlyTypeForCPP03 typedef is for Chromium's base/callback.h 34 // details. The MoveOnlyTypeForCPP03 typedef is for Chromium's base/callback.h
35 // to tell that this type is move-only. 35 // to tell that this type is move-only.
36 #define MOJO_MOVE_ONLY_TYPE(type) \ 36 #define MOJO_MOVE_ONLY_TYPE(type) \
37 private: \ 37 private: \
38 type(type&); \ 38 type(const type&); \
39 void operator=(type&); \ 39 void operator=(const type&); \
40 \ 40 \
41 public: \ 41 public: \
42 type&& Pass() MOJO_WARN_UNUSED_RESULT { return static_cast<type&&>(*this); } \ 42 type&& Pass() MOJO_WARN_UNUSED_RESULT { return static_cast<type&&>(*this); } \
43 typedef void MoveOnlyTypeForCPP03; \ 43 typedef void MoveOnlyTypeForCPP03; \
44 \ 44 \
45 private: 45 private:
46 46
47 // The C++ standard requires that static const members have an out-of-class 47 // The C++ standard requires that static const members have an out-of-class
48 // definition (in a single compilation unit), but MSVC chokes on this (when 48 // definition (in a single compilation unit), but MSVC chokes on this (when
49 // language extensions, which are required, are enabled). (You're only likely to 49 // language extensions, which are required, are enabled). (You're only likely to
(...skipping 22 matching lines...) Expand all
72 // Used to explicitly mark the return value of a function as unused. (Use this 72 // Used to explicitly mark the return value of a function as unused. (Use this
73 // if you are really sure you don't want to do anything with the return value of 73 // if you are really sure you don't want to do anything with the return value of
74 // a function marked with |MOJO_WARN_UNUSED_RESULT|. 74 // a function marked with |MOJO_WARN_UNUSED_RESULT|.
75 template <typename T> 75 template <typename T>
76 inline void ignore_result(const T&) { 76 inline void ignore_result(const T&) {
77 } 77 }
78 78
79 } // namespace mojo 79 } // namespace mojo
80 80
81 #endif // MOJO_PUBLIC_CPP_SYSTEM_MACROS_H_ 81 #endif // MOJO_PUBLIC_CPP_SYSTEM_MACROS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698