2 ms·
Obviously, full memory safety is not ensured if you ever move over to raw pointers. But if you're copying shared_ptrs around, the reference counting almost alw
by dragontamer 11y ago
Obviously, full memory safety is not ensured if you ever move over to raw pointers.
But if you're copying shared_ptrs around, the reference counting almost always ensures that the memory is valid. The idea is to rarely use references or raw-pointers unless you know you have to.
- pcwalton 11y agoI'm not questioning how shared_ptr works. I'm claiming that using it as extensively as you describe is totally impractical, and no C++ code works this way.
- dragontamer 11y agoI've found the UWP Windows 10 API to be using shared_ptrs and stuff more often. A lot of things are done 'correctly'. Its mostly when interacting with legacy code (ie: MFC) where issues come up.
- pcwalton 11y agoC++ programs written using UWP make heavy use of references, like all C++ programs, and are highly vulnerable to use after free.