|
@@ -41,7 +41,8 @@ Example: |
|
|
delete foo; |
|
|
delete foo; |
|
|
weakFoo.get(); // returns nullptr |
|
|
weakFoo.get(); // returns nullptr |
|
|
|
|
|
|
|
|
Caveat: In multithreaded environments, the object pointed to by the WeakPtr could be deleted at any time after obtaining its pointer from WeakPtr. |
|
|
|
|
|
|
|
|
Not thread safe. |
|
|
|
|
|
In multithreaded environments, the object pointed to by the WeakPtr could be deleted at any time after obtaining its pointer from WeakPtr. |
|
|
*/ |
|
|
*/ |
|
|
template <typename T> |
|
|
template <typename T> |
|
|
struct WeakPtr { |
|
|
struct WeakPtr { |
|
|