diff options
author | 2017-01-27 08:20:17 -0500 | |
---|---|---|
committer | 2017-01-27 18:17:48 +0000 | |
commit | 1b2b3fbd1e71376957c8db2dbcfbd8e438403ff7 (patch) | |
tree | 216fa3049ec6b6e47556f5c8f65b2586c75985d1 /src/utils | |
parent | 00dca8cb09aaeca067cac022e97c4af31e656b37 (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.h | 9 |
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; } |