We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1db1332 commit e3627b7Copy full SHA for e3627b7
APIs_Platform/Shared_pointer/README.md
APIs_Platform/Shared_pointer/main.cpp
@@ -0,0 +1,18 @@
1
+#include "platform/SharedPtr.h"
2
+
3
+int main(void)
4
+{
5
+ struct MyStruct {
6
+ int a;
7
+ };
8
9
+ // Create shared pointer
10
+ SharedPtr<MyStruct> ptr(new MyStruct);
11
12
+ // Increase reference count
13
+ SharedPtr<MyStruct> ptr2(ptr);
14
15
+ ptr = nullptr; // Reference to the struct instance is still held by ptr2
16
17
+ ptr2 = nullptr; // The raw pointer is freed
18
+}
0 commit comments