• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Small footprint UI library for hardware accelerated games & applications


Commit MetaInfo

Revisionb1ae918352827bfc74e47136ecf0f5d693fe8401 (tree)
Time2017-09-18 23:21:21
AuthorStarg <starg@user...>
CommiterStarg

Log Message

Added a constructor taking nullptr to TBUniquePointer

Change Summary

Incremental Difference

--- a/src/tb/tb_memory.h
+++ b/src/tb/tb_memory.h
@@ -12,6 +12,7 @@ class TBUniquePointer
1212 {
1313 public:
1414 TBUniquePointer() : m_p(nullptr) {}
15+ TBUniquePointer(decltype(nullptr)) : m_p(nullptr) {}
1516 explicit TBUniquePointer(T *p) : m_p(p) {}
1617
1718 TBUniquePointer(const TBUniquePointer &) = delete;
@@ -30,6 +31,12 @@ public:
3031 return *this;
3132 }
3233
34+ TBUniquePointer &operator=(decltype(nullptr))
35+ {
36+ Reset();
37+ return *this;
38+ }
39+
3340 ~TBUniquePointer()
3441 {
3542 Reset();
@@ -57,6 +64,8 @@ public:
5764 m_p = p;
5865 }
5966
67+ void Set(decltype(nullptr)) { Reset(); }
68+
6069 explicit operator bool() const { return !!m_p; }
6170 T *Get() { return m_p; }
6271 const T *Get() const { return m_p; }