Chromium Code Reviews| Index: mojo/public/cpp/bindings/struct_ptr.h |
| diff --git a/mojo/public/cpp/bindings/struct_ptr.h b/mojo/public/cpp/bindings/struct_ptr.h |
| index efcf255e3ae7d454067758d30aab592b33ffc9df..60f3c87415afb7d28b01ecfab54e7b9efc006ac2 100644 |
| --- a/mojo/public/cpp/bindings/struct_ptr.h |
| +++ b/mojo/public/cpp/bindings/struct_ptr.h |
| @@ -27,16 +27,23 @@ class StructHelper { |
| template <typename Struct> |
| class StructPtr { |
| - MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(StructPtr, RValue); |
| + MOJO_MOVE_ONLY_TYPE(StructPtr) |
| public: |
| StructPtr() : ptr_(nullptr) {} |
| + StructPtr(decltype(nullptr)) : ptr_(nullptr) {} |
| + |
| ~StructPtr() { delete ptr_; } |
| - StructPtr(RValue other) : ptr_(nullptr) { Take(other.object); } |
| - StructPtr& operator=(RValue other) { |
| - Take(other.object); |
| + StructPtr& operator=(decltype(nullptr)) { |
| + reset(); |
| + return *this; |
| + } |
| + |
| + StructPtr(StructPtr&& other) : ptr_(nullptr) { Take(&other); } |
| + StructPtr& operator=(StructPtr&& other) { |
| + Take(&other); |
| return *this; |
| } |
| @@ -101,16 +108,16 @@ class StructPtr { |
| // Designed to be used when Struct is small and copyable. |
| template <typename Struct> |
| class InlinedStructPtr { |
| - MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(InlinedStructPtr, RValue); |
| + MOJO_MOVE_ONLY_TYPE(InlinedStructPtr); |
| public: |
| InlinedStructPtr() : is_null_(true) {} |
| ~InlinedStructPtr() {} |
|
darin (slow to review)
2015/01/14 18:38:07
don't you need the nullptr ctor and assignment ope
jamesr
2015/01/14 18:39:30
Hmm yes - I didn't find a user of this but it'd be
|
| - InlinedStructPtr(RValue other) : is_null_(true) { Take(other.object); } |
| - InlinedStructPtr& operator=(RValue other) { |
| - Take(other.object); |
| + InlinedStructPtr(InlinedStructPtr&& other) : is_null_(true) { Take(&other); } |
| + InlinedStructPtr& operator=(InlinedStructPtr&& other) { |
| + Take(&other); |
| return *this; |
| } |