diff options
author | Jeff Sharkey <jsharkey@android.com> | 2017-09-13 11:04:06 -0600 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2017-09-13 11:06:07 -0600 |
commit | 147b881ca906ad3f7f1b9acf20304054df3e5ea1 (patch) | |
tree | 058a4d2d489fa50e3b3c095b5455f949e540a1e7 | |
parent | 2827106d7d95b5e2d41b846f1505fbfacc56d850 (diff) | |
download | system_core-147b881ca906ad3f7f1b9acf20304054df3e5ea1.tar.gz system_core-147b881ca906ad3f7f1b9acf20304054df3e5ea1.tar.bz2 system_core-147b881ca906ad3f7f1b9acf20304054df3e5ea1.zip |
Add "operator bool" overload to android::sp.
This matches the overload on std::unique_ptr and friends.
Test: builds, boots
Bug: 13758960
Change-Id: Ieed9faa6b162c2a10fa7cf2b135c9b17564f6c88
-rw-r--r-- | libutils/include/utils/StrongPointer.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libutils/include/utils/StrongPointer.h b/libutils/include/utils/StrongPointer.h index 0c2060791..ae6d9c82e 100644 --- a/libutils/include/utils/StrongPointer.h +++ b/libutils/include/utils/StrongPointer.h @@ -82,9 +82,10 @@ public: // Accessors - inline T& operator* () const { return *m_ptr; } - inline T* operator-> () const { return m_ptr; } - inline T* get() const { return m_ptr; } + inline T& operator* () const { return *m_ptr; } + inline T* operator-> () const { return m_ptr; } + inline T* get() const { return m_ptr; } + inline explicit operator bool () const { return m_ptr != nullptr; } // Operators |