What is Nostr?
tragic
npub1u07…ez97
2024-09-19 19:14:25
in reply to nevent1q…429l

tragic on Nostr: Smart pointers are extremely useful and make writing C++ a lot safer. One of the most ...

Smart pointers are extremely useful and make writing C++ a lot safer.

One of the most common bugs C has is leaking resources and double free-ing.

A smart pointer makes sure your resources are deallocated when they go out of scope. A shared smart pointer is one that when it gets copied, it points to the same resource but increases the ownership count, decreses the ownership count when it goes out of scope. So for shared smart pointers their resources only get release when the ownership count drops to 0.
Author Public Key
npub1u07xw079lxwv24xslarh2eu4v37jtjmwvev0jyk3zjhxg2wnt56seyez97