3 ms·
Give more meaningful type names to raw C++ pointers
- ArchD 12y agoWhy not just use smart pointers like unique_ptr and shared_ptr and call it a day? Dealing with raw pointers that require manual management is like running with scissors.
- cornibies 12y agoI generally agree. However, smart pointers imply ownership of the object, especially unique_ptr. Using shared_ptr is a good solution to ensure that the object is both alive when needed and deleted when not - but for the reader it is still not clear whether the instance pointed to will be available after the returned shared_ptr has fallen out of scope. That said, I will definitely not argue against the use of smart pointers wherever possible :) cheers!