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

Unified Diff: mojo/public/cpp/system/macros.h

Issue 828373008: Allow constructing {Interface,Struct}Ptr from nullptr (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/system/macros.h
diff --git a/mojo/public/cpp/system/macros.h b/mojo/public/cpp/system/macros.h
index 564b6bea6a3e4dd6c04a60170fb8f46dc358196a..f2bd0bcc6fbff5c6c83f8aed68dcf92fa20332d8 100644
--- a/mojo/public/cpp/system/macros.h
+++ b/mojo/public/cpp/system/macros.h
@@ -29,21 +29,17 @@ char(&ArraySizeHelper(const T(&array)[N]))[N];
} // namespace mojo
#define MOJO_ARRAYSIZE(array) (sizeof(::mojo::ArraySizeHelper(array)))
-// Used to make a type move-only in C++03. See Chromium's base/move.h for more
-// details.
-#define MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(type, rvalue_type) \
- private: \
- struct rvalue_type { \
- explicit rvalue_type(type* object) : object(object) {} \
- type* object; \
- }; \
- type(type&); \
- void operator=(type&); \
- \
- public: \
- operator rvalue_type() { return rvalue_type(this); } \
- type Pass() { return type(rvalue_type(this)); } \
- typedef void MoveOnlyTypeForCPP03; \
- \
+// Used to make a type move-only. See Chromium's base/move.h for more
+// details. The MoveOnlyTypeForCPP03 typedef is for Chromium's base/callback to
+// tell that this type is move-only.
+#define MOJO_MOVE_ONLY_TYPE(type) \
+ private: \
+ type(type&); \
+ void operator=(type&); \
+ \
+ public: \
+ type&& Pass() MOJO_WARN_UNUSED_RESULT { return static_cast<type&&>(*this); } \
+ typedef void MoveOnlyTypeForCPP03; \
+ \
private:
#endif // MOJO_PUBLIC_CPP_SYSTEM_MACROS_H_

Powered by Google App Engine
This is Rietveld 408576698