2 ms·
What problems have you found trying to write memory safe code? It seems to me that you barely have to think about memory ownership anymore ever since unique_pt
by 5hoom 12y ago
What problems have you found trying to write memory safe code?
It seems to me that you barely have to think about memory ownership anymore ever since unique_ptr and shared_ptr came along.
- evincarofautumn 12y agoI suppose my main gripes are that moving is not free, you can reuse moved-from objects, and there is no story for checked borrowing of unique_ptrs—you have to use raw pointers or weaken the ownership semantics to shared_ptr so that you can use weak_ptr for safe borrowing. Not to mention that shared_ptr is often semantically questionable and used as an inefficient alternative to a garbage collector.
- 5hoom 12y agoFair enough, good answer :)