Browse Source

casting for unique pointers

Kajetan Johannes Hammerle 3 năm trước cách đây
mục cha
commit
9df4fa0b0f
1 tập tin đã thay đổi với 8 bổ sung0 xóa
  1. 8 0
      memory/UniquePointer.h

+ 8 - 0
memory/UniquePointer.h

@@ -39,6 +39,14 @@ public:
     const T* operator->() const {
         return t;
     }
+
+    operator T*() {
+        return t;
+    }
+
+    operator const T*() const {
+        return t;
+    }
 };
 
 #endif