aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-01-27 08:20:17 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-27 18:17:48 +0000
commit1b2b3fbd1e71376957c8db2dbcfbd8e438403ff7 (patch)
tree216fa3049ec6b6e47556f5c8f65b2586c75985d1 /src/utils
parent00dca8cb09aaeca067cac022e97c4af31e656b37 (diff)
SkTScopedComPtr: implicit nullptr cast to SkTScopedComPtr<T>()
Change-Id: Ic09da242650eb20164f31333e912fc899428c548 Reviewed-on: https://skia-review.googlesource.com/7634 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/win/SkTScopedComPtr.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/utils/win/SkTScopedComPtr.h b/src/utils/win/SkTScopedComPtr.h
index b8aeb73d82..f44740ff44 100644
--- a/src/utils/win/SkTScopedComPtr.h
+++ b/src/utils/win/SkTScopedComPtr.h
@@ -37,17 +37,20 @@ private:
T *fPtr;
public:
- explicit SkTScopedComPtr(T *ptr = nullptr) : fPtr(ptr) { }
+ constexpr SkTScopedComPtr() : fPtr(nullptr) {}
+ constexpr SkTScopedComPtr(std::nullptr_t) : fPtr(nullptr) {}
+ explicit SkTScopedComPtr(T *ptr) : fPtr(ptr) {}
+ SkTScopedComPtr(SkTScopedComPtr&& that) : fPtr(that.release()) {}
+ SkTScopedComPtr(const SkTScopedComPtr&) = delete;
~SkTScopedComPtr() { this->reset();}
- SkTScopedComPtr(SkTScopedComPtr&& that) : fPtr(that.release()) {}
- SkTScopedComPtr(const SkTScopedComPtr&) = delete;
SkTScopedComPtr& operator=(SkTScopedComPtr&& that) {
this->reset(that.release());
return *this;
}
SkTScopedComPtr& operator=(const SkTScopedComPtr&) = delete;
+ SkTScopedComPtr& operator=(std::nullptr_t) { this->reset(); return *this; }
T &operator*() const { SkASSERT(fPtr != nullptr); return *fPtr; }