>Can you write code that is completely safe?
Yes. Just don't use raw pointers. Use unique_ptr, shared_ptr and weak_ptr instead.
Yes. Just don't use raw pointers. Use unique_ptr, shared_ptr and weak_ptr instead.
Just off the top of my head smart pointers do not protect against:
- null pointer dereferences
- out of bounds array access
- iterator invalidation
- dangling (non-owning) references