mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 01:57:35 +00:00
AK: Improve smart pointer ergonomics a bit.
This commit is contained in:
parent
d5dec1922b
commit
3f6408919f
17 changed files with 49 additions and 31 deletions
|
@ -66,9 +66,6 @@ public:
|
|||
|
||||
bool operator!() const { return !m_ptr; }
|
||||
|
||||
typedef T* OwnPtr::*UnspecifiedBoolType;
|
||||
operator UnspecifiedBoolType() const { return m_ptr ? &OwnPtr::m_ptr : nullptr; }
|
||||
|
||||
T* leak_ptr()
|
||||
{
|
||||
T* leakedPtr = m_ptr;
|
||||
|
@ -85,6 +82,9 @@ public:
|
|||
T& operator*() { return *m_ptr; }
|
||||
const T& operator*() const { return *m_ptr; }
|
||||
|
||||
operator const T*() const { return m_ptr; }
|
||||
operator T*() { return m_ptr; }
|
||||
|
||||
operator bool() { return !!m_ptr; }
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue