4 ms·
Wouldn't you have a problem with reference cycles in C++ smart pointers? Not sure if they do anything special to prevent this.
by zach43 9y ago
Wouldn't you have a problem with reference cycles in C++ smart pointers? Not sure if they do anything special to prevent this.
- saagarjha 9y agostd::weak_ptr is there for resolving reference cycles.
- pdpi 9y agoWhich means you have to design around it. You can definitely run into problems with cyclical shared_ptr dependencies
- nobugs 9y agostd::unique_ptr<> won't allow you to have 'owning' reference cycles; neither 'owning' reference cycles are really necessary in real-world programs.