Small footprint UI library for hardware accelerated games & applications
Revision | b1ae918352827bfc74e47136ecf0f5d693fe8401 (tree) |
---|---|
Time | 2017-09-18 23:21:21 |
Author | Starg <starg@user...> |
Commiter | Starg |
Added a constructor taking nullptr to TBUniquePointer
@@ -12,6 +12,7 @@ class TBUniquePointer | ||
12 | 12 | { |
13 | 13 | public: |
14 | 14 | TBUniquePointer() : m_p(nullptr) {} |
15 | + TBUniquePointer(decltype(nullptr)) : m_p(nullptr) {} | |
15 | 16 | explicit TBUniquePointer(T *p) : m_p(p) {} |
16 | 17 | |
17 | 18 | TBUniquePointer(const TBUniquePointer &) = delete; |
@@ -30,6 +31,12 @@ public: | ||
30 | 31 | return *this; |
31 | 32 | } |
32 | 33 | |
34 | + TBUniquePointer &operator=(decltype(nullptr)) | |
35 | + { | |
36 | + Reset(); | |
37 | + return *this; | |
38 | + } | |
39 | + | |
33 | 40 | ~TBUniquePointer() |
34 | 41 | { |
35 | 42 | Reset(); |
@@ -57,6 +64,8 @@ public: | ||
57 | 64 | m_p = p; |
58 | 65 | } |
59 | 66 | |
67 | + void Set(decltype(nullptr)) { Reset(); } | |
68 | + | |
60 | 69 | explicit operator bool() const { return !!m_p; } |
61 | 70 | T *Get() { return m_p; } |
62 | 71 | const T *Get() const { return m_p; } |